Jump to content

Its Not Displaying The Data From Mysql


madness69

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.