I'm having a little trouble with some code and was wondering if any one can figure this out? I'm guessing that it has something to do with PHP's abilities to handle mSQL queries but here's the code:
if ($subject=="TRANSIT")
{
$sql = "SELECT * FROM vidandpublib WHERE VP='P' ".
"AND (subject='TRANSIT: developing & maintaining services & programs' ".
"OR subject='TRANSIT: general' OR subject='TRANSIT: legislation' ".
"OR subject='TRANSIT: management' ".
"OR subject='TRANSIT: planning & design' ".
"OR subject='TRANSIT: ridesharing & ridership' ".
"OR subject='TRANSIT: small & urban cities' ".
"OR subject='TRANSIT: vehicle & driving') ORDER BY vidorpubname";
}
if ($subject=="VEHICLES & EQUIPMENT")
{
$sql = "SELECT * FROM vidandpublib WHERE VP='P' ".
"AND (subject='VEHICLES & EQUIPMENT: maintenance & management' ".
"OR subject='VEHICLES & EQUIPMENT: operations') ORDER BY vidorpubname";
}
else
{
$sql = "SELECT * FROM vidandpublib WHERE VP='P' ".
"AND subject='$subject' ORDER BY vidorpubname";
}
$result1=msql_query($sql, $link_id);
I know that the queries work correctly because I tried them in the msql monitor but the else statement is the only one that works when called from the form. Previously I had 3 ifs and the first two didn't work but the last if and the else worked. Now, I have 2 ifs and both ifs don't work (and they aren't the same non-working ifs as in the first example) and the else still works. Any suggestions would be appreciated greatly.