Hi, I have a script that queries a database many times on one page, and each time the query information is the same, except for one WHERE something LIKE something statement. I want to create this function:
Variables such as $num_results are not going to be able to be used (I don't think) outside this function. How do I automatically make all variables outside a function work inside a function, and all variables inside a function work outside the function? It would take me forever to make the variables I need global one by one.PHP Code:function query($category) {$query = "SELECT some_columns FROM business WHERE category like '$category' ORDER BY category ASC";
$result = mysql_query($query) or die(mysql_error()."<br />".$query);
$num_results = mysql_num_rows($result);}
Thanks.





Bookmarks