Incredinot Posted August 17, 2010 Share Posted August 17, 2010 Hi.. So what i want to do is basicly to check if id XX exist in my database. How can this be done? Im thinking of something like: if(xx exist){do this} else{do this} Iv'e tried google etc before i posted here, but couldent really find anything where i found a soutable answer.. Hope someone can help! (: Link to comment https://forums.phpfreaks.com/topic/210945-check-if-value-exist/ Share on other sites More sharing options...
trq Posted August 17, 2010 Share Posted August 17, 2010 // make connection $sql = "SELECT fld FROM tbl WHERE fld = 'XX'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { // XX exists } else { // XX not found } } Link to comment https://forums.phpfreaks.com/topic/210945-check-if-value-exist/#findComment-1100250 Share on other sites More sharing options...
Incredinot Posted August 17, 2010 Author Share Posted August 17, 2010 Wow, that was fast! (: Thanks alot dude.. Thumbs up Link to comment https://forums.phpfreaks.com/topic/210945-check-if-value-exist/#findComment-1100251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.