Jump to content

weird result when retrieving ID from mysql


ivytony

Recommended Posts

I think this is a more PHP question than MysQL. If the moderator thinks I am wrong, you are welcome to move the topic to mysql board.

 

I have the following code

 

$domain = 'cnn.com';

$sql = "SELECT id FROM table_news WHERE domain = '$domain'";    //id is the primary key, auto-incrmented

 

$row = $db->query($sql);

echo $row['id'];    //the domain cnn.com in the table corresponds to the ID 10, but this echo gives me 1, I don't know where I made it wrong.

 

someone can help me out?

 

thanks!

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.