Jump to content

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 />";
}
}

Edited by madness69
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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.