this.user Posted May 10, 2010 Share Posted May 10, 2010 this is what i use $result = mysql_query("SELECT id FROM table WHERE name='jon LIMIT 1'"); if(mysql_num_rows($result) == 1) { echo "hit"; } I read online that there are better ways, would someone kindly fill me in on the alternatives and how/if they improve performance? thanks Quote Link to comment https://forums.phpfreaks.com/topic/201221-what-is-the-best-and-fasted-way-to-determine-if-your-query-landed/ Share on other sites More sharing options...
budlust Posted May 10, 2010 Share Posted May 10, 2010 http://php.net/manual/en/function.var-dump.php $result = mysql_query("SELECT id FROM table WHERE name='jon LIMIT 1'"); var_dump($result); oops misread your post, this would be for debugging Quote Link to comment https://forums.phpfreaks.com/topic/201221-what-is-the-best-and-fasted-way-to-determine-if-your-query-landed/#findComment-1055666 Share on other sites More sharing options...
Mchl Posted May 10, 2010 Share Posted May 10, 2010 What do you mean 'if query landed' ? There's no other way i know of checking if there are rows returned, than actually... checking if there are rows returned. If you wan't to check if your query ran without error, then just check if $result != false Quote Link to comment https://forums.phpfreaks.com/topic/201221-what-is-the-best-and-fasted-way-to-determine-if-your-query-landed/#findComment-1055682 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.