Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
I am new to PHP and mySQL and this is a section of my program, but what happens is that it doesn’t return the value of the column ‘Text’ from the database, rather, it says ‘Undefined index ‘Text”. I am 100% sure that it exists in the database. Can someone please help me?
$method_get_article = "SELECT TEXT FROM ARTICLE WHERE UID = '$user_id' LIMIT 1";
$get_article = mysql_query($method_get_article, $conn) or die (mysql_error());
$article = mysql_fetch_array($get_article);**strong text**
$text = $article['Text'];
//$row = mysql_fetch_assoc($get_article);
//$text = $row['Text'];
echo $text;
The error explains the problem very clearly : ‘Undefined index ‘Text’
In the beginning you write:
which means you select the column called “TEXT”, and then later you write:
which gets the column called “Text”.
Change them so that they are identical.