lee20 Posted August 11, 2003 Share Posted August 11, 2003 i\'m trying to query the database and only get one result. i\'ve always used while loops when i query the database, but i need to query for the first matching criteria and return that row. $select = \"SELECT * FROM `table Where value=\'$variable\'\"; $query = mysql_query($select); while($row = mysql_fetch_row($query)) { //I want to return only the first row with the matching criteria. $var1= $row[0]; etc.. } Help! Thx Quote Link to comment Share on other sites More sharing options...
effigy Posted August 11, 2003 Share Posted August 11, 2003 don\'t use the while... $select = "SELECT * FROM `table Where value=\'$variable\'"; $query = mysql_query($select); $row = mysql_fetch_row($query); $var1= $row[0]; Quote Link to comment Share on other sites More sharing options...
lee20 Posted August 11, 2003 Author Share Posted August 11, 2003 that easy huh? thx 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.