Hi!

I have problems with php fetching data from a mediumtext variable in mysql. I have a mysql table containing content entered in fckeditor. Since the variable will contain a lot of characters I use the mediumtext format.

I try to echo the content an nothing happens, the page is blank and I get no errors.

The code for getting the data is:

include "config.php";
include "connect_database.php";

// Get data from the database
   $query = mysql_query("SELECT `text` FROM `fck_data` WHERE `id` =1");
  $data = mysql_fetch_array($query);
  echo $data[data]; ?>

It works fine if i do exacly the same thing with variable data, that is a text variable.

Can´t I use the mysql_fetch_array for mediumtext??

Here is the create table statement:

CREATE TABLE IF NOT EXISTS fck_data (
id int(11) NOT NULL AUTO_INCREMENT,
data text NOT NULL,
text mediumtext NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--

-- Data i tabell fck_data

INSERT INTO fck_data (id, data, text) VALUES
(1, '<p>dfafcefejhkj en fin fin sidag och fin och fin jenny</p>djfadfie\r\n<p><select name="testa" size="2">\r\n<option value="a">a</option>\r\n</select></p>', '<p>mediumtext</p>djfadfie\r\n<p><select name="testa" size="2">\r\n<option value="a">a</option>\r\n</select></p>');

    You only SELECT'ed the textcolumn; if you want data form the data column, then you have to include that column as well.

      Of course! Sorry. I messed up the $data and the variable data. I used an example, and I didn´t really understand everything.

      Thank you
      Jenny

        So.. did you resolve your issue? If so, don't forget to mark this thread resolved using the link on the Thread Tools menu.

          Write a Reply...