jenniferG Posted October 24, 2007 Share Posted October 24, 2007 This is probably silly, but in the below script, does $FIND contain the count or do I have to do something in addition? The manual covers just mysql command line querys. /* $NOUNITQUERY="SELECT COUNT(*) FROM SISTOCK WHERE CAMERAMODEL='$CAMERAMODEL'"; $FIND= mysql_query($NOUNITQUERY); */ Thanks, Jennifer Quote Link to comment https://forums.phpfreaks.com/topic/74528-counting-rows-in-database/ Share on other sites More sharing options...
teng84 Posted October 24, 2007 Share Posted October 24, 2007 $NOUNITQUERY="SELECT COUNT(*) as my_count FROM SISTOCK WHERE CAMERAMODEL='$CAMERAMODEL'"; $FIND= mysql_query($NOUNITQUERY); $got_it = mysql_fetch_assoc($FIND); $value_is_here = $got_it[my_count]; note: better to use spsecific field rather than * Quote Link to comment https://forums.phpfreaks.com/topic/74528-counting-rows-in-database/#findComment-376688 Share on other sites More sharing options...
Toshiba23 Posted October 24, 2007 Share Posted October 24, 2007 if you want to know how many rows are returned from your query, use mysql_num_rows($resource) Quote Link to comment https://forums.phpfreaks.com/topic/74528-counting-rows-in-database/#findComment-376799 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.