enhu Posted October 30, 2008 Share Posted October 30, 2008 Notice: Undefined index: positon in C:\wamp\www\enhu\content.php on line 15 About Enhu $result = mysql_query("SELECT * FROM subjects", $connection); if (!$result) { die("Database query failed: " . mysql_error()); } while ($row = mysql_fetch_array($result)) { echo $row["menu_name"]." ".$row["positon"]."<br />"; } The line 15th line the while statement: Quote Link to comment https://forums.phpfreaks.com/topic/130761-help-a-newbie-problem-here-with-the-undefined-index/ Share on other sites More sharing options...
dropfaith Posted October 30, 2008 Share Posted October 30, 2008 .$row["positon"]. its sayin this doesnt exist from your db are you sure thats the exact name of the field Quote Link to comment https://forums.phpfreaks.com/topic/130761-help-a-newbie-problem-here-with-the-undefined-index/#findComment-678621 Share on other sites More sharing options...
enhu Posted October 30, 2008 Author Share Posted October 30, 2008 i'm not really sure how to fix this, does this mean that i have to input it again to the database or should i replace the syntax so it would function? Quote Link to comment https://forums.phpfreaks.com/topic/130761-help-a-newbie-problem-here-with-the-undefined-index/#findComment-678648 Share on other sites More sharing options...
enhu Posted October 30, 2008 Author Share Posted October 30, 2008 you were right. i take the ".$row["positon"] away and leave the while statement to this hile ($row = mysql_fetch_array($result)) { echo $row["menu_name"]."<br />"; } and it works. thank you. you didnt seem to drop my faith at all. Quote Link to comment https://forums.phpfreaks.com/topic/130761-help-a-newbie-problem-here-with-the-undefined-index/#findComment-678662 Share on other sites More sharing options...
Maq Posted October 30, 2008 Share Posted October 30, 2008 Go to your database with PhpMyAdmin or w/e you use and find out what fields you have in the 'subject' table. When you SELECT * it means you select everything and if you only need that one row then only select menu_name. So obviously the position field does not exist. Quote Link to comment https://forums.phpfreaks.com/topic/130761-help-a-newbie-problem-here-with-the-undefined-index/#findComment-678719 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.