ivytony Posted February 22, 2008 Share Posted February 22, 2008 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! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted February 22, 2008 Share Posted February 22, 2008 $ID holds the result of the query function. you still need to pull a row from the result set $ID. Quote Link to comment Share on other sites More sharing options...
ivytony Posted February 22, 2008 Author Share Posted February 22, 2008 thanks, I corrected my code, but it still shows 1, not 10. I am wondering why. Quote Link to comment 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.