My search engine is being inconsistent and I can't figure out why. Here's the code: (I realize this may not be ideal code, but it works....sometimes)
[PHP
//assigns categories and provinces arrays from main page to variables
$categories = $POST['categories'];
$provinces = $POST['provinces'];
//registers the categories and locations as session varables
session_register("categories", "provinces");
/redefines the variables so they can be used to access the session variables
$categories = $SESSION['categories'];
$provinces = $SESSION['provinces'];
[/code]
Basically, I'm taking the variables from the first page, registering them as session variables and then re-saving them to the same name so I can use them in queries, etc.
Most of the time this works, but sometimes I get a message saying "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource ". Apparently, sometimes the province and categories variables are being registered, but don't seem to be set properly. If I add the code:
//
//$_SESSION['categories'] = $categories;
//$_SESSION['provinces'] = $provinces;
after I register the variables, it works on the first page, but not if I go to another page in the results. And then, when I take these lines out, it magically works again.
I really don't know why it seems to cut in and out. I think I have the main idea down, ie get the variables, register them as session variables, and then redefine them so they can be used in future pages. What's the problem? Try to keep things simple please...still learning.