Hi there,
I want to make my own function which performs in a similar manner to the following actual code.. ie
if(mysql_num_rows($res) == FALSE) {
// DO SOMETHING BECAUSE THERE ARE NO RESULTS
}
In my code, i'm repeating an SQL statement a few times around the place, and if there are results, then I go ahead and do stuff.
What I'd like to do is create my own FALSE return in my own function ie
if(my_special_function($variable) == FALSE) {
// DO STUFF
}
Is this as simple as in my special function having something like...
function my_special_function($variable) {
$sql = 'SELECT field FROM table WHERE something=$variable';
$res = mysql_query($sql);
if(mysql_num_rows($res) == FALSE) {
return FALSE;
} else {
return TRUE;
}
}
?