Syntax error?
| From: | Bradley | Date: | Mon, 17 Apr 2000 07:19:22 +0000 |
| Subject: | Syntax error? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13618@lists.php.net to get a copy of this message | ||
I'm hoping this is a case of a simple syntax error and someone can clear this up fairly
quickly. If more info is needed, please let me know. I'm sure I'm missing something fairly
basic here, and if so, please straighten me out.
I'm using this bit of code to do a simple query based on a couple of variables:
"
$db = mysql_connect("***server****", "****username****",
"****password****");
mysql_select_db("gu_mgmt",$db);
if ($subcats == "All") {
$result = mysql_query("SELECT * FROM $catty",$db);
} else {
$result = mysql_query("SELECT * FROM $catty WHERE SubCategory = '$subcats' order by
DateAcquired",$db);
}
"
The first bit of the "if" works just fine, but the second bit seems to return an empty
result. I get no errors whatsoever, I just don't get any info on the page. Does it have
something to do with the way I've used the variable to represent the table name? I'm
terribly confused.
This script worked FINE when I was only passing the "subcats" variable. It didn't
break until I tried throwing in the "catty" variable. I had the name of the table
hardcoded before, but now I want to dynamically use the same script to check a few different tables
in the same db.
Thanks in advance for any and all help.
Bradley