How do I make my own true / false return function?

Lofnoinge

New Member
I want to make my own function which performs in a similar manner to the following actual code.. ie\[code\]if(mysql_num_rows($res) == FALSE) { // DO SOMETHING BECAUSE THERE ARE NO RESULTS}\[/code\]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\[code\]if(my_special_function($variable) == FALSE) { // DO STUFF}\[/code\]Is this as simple as in my special function having something like...\[code\]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; }}\[/code\]?
 
Back
Top