SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
May 6, 2006, 20:13 #1
- Join Date
- Aug 2004
- Location
- United States
- Posts
- 154
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Making All Variables Automatically Global?
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:
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.
-
May 6, 2006, 22:51 #2
- Join Date
- Mar 2006
- Posts
- 6,132
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
if you want everything done within the global scope, maybe thats what you should do. just use an include file and include it into the global scope.
Bookmarks