beermaker74 Posted February 21, 2007 Share Posted February 21, 2007 I need to do some checks for someof my dynamic pages. What I need to do is go thru the complete table for one field and see if a value exists. the values are either y n or null. I only need to check for y. IS there a quick and dirty method to do this? Thanks for the help Quote Link to comment Share on other sites More sharing options...
tom100 Posted February 21, 2007 Share Posted February 21, 2007 if (mysql_num_rows(mysql_query("SELECT * FROM `tablename` WHERE `blah` = 'y')) > 0) Quote Link to comment Share on other sites More sharing options...
beermaker74 Posted February 21, 2007 Author Share Posted February 21, 2007 thanks just what i was looking for Quote Link to comment Share on other sites More sharing options...
trq Posted February 21, 2007 Share Posted February 21, 2007 <?php // connect to db if ($result = mysql_query("SELECT fld FROM tbl WHERE fld = 'y'")) { if (mysql_num_rows($result)) { // y was found } } ?> 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.