madness69 Posted December 13, 2012 Share Posted December 13, 2012 Hello there, im having some problem whit my php code, i cant display the data from my database, is there somethign missing or wrong? Here is the code: $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } if(isset($_GET['id'])) { $id=$_GET['id']; mysql_select_db("db_name", $con); $result = mysql_query("SELECT * FROM comments WHERE article = '".$row['title']."' AND approved = 'YES'"); while($row = mysql_fetch_array($result)) { echo $row['name'] . " " . $row['email']; echo "<br />"; } } Link to comment https://forums.phpfreaks.com/topic/271974-its-not-displaying-the-data-from-mysql/ Share on other sites More sharing options...
Jessica Posted December 13, 2012 Share Posted December 13, 2012 See the post in my signature. Link to comment https://forums.phpfreaks.com/topic/271974-its-not-displaying-the-data-from-mysql/#findComment-1399245 Share on other sites More sharing options...
madness69 Posted December 13, 2012 Author Share Posted December 13, 2012 ..., thanks anyway, bye Link to comment https://forums.phpfreaks.com/topic/271974-its-not-displaying-the-data-from-mysql/#findComment-1399247 Share on other sites More sharing options...
Barand Posted December 13, 2012 Share Posted December 13, 2012 Quote $result = mysql_query("SELECT * FROM commentsWHERE article = '".$row['title']."' AND approved = 'YES'"); $row has not yet been assigned a value Link to comment https://forums.phpfreaks.com/topic/271974-its-not-displaying-the-data-from-mysql/#findComment-1399248 Share on other sites More sharing options...
Hall of Famer Posted December 13, 2012 Share Posted December 13, 2012 Yeah, sorta seems that way to me too, what is $row['title']? Perhaps you should use this instead: $_GET['title'] Not sure if this helps though, it's difficult to help you unless we know what this $row['title'] is supposed to mean. Link to comment https://forums.phpfreaks.com/topic/271974-its-not-displaying-the-data-from-mysql/#findComment-1399257 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.