View Single Post
Old 01-08-2013, 10:13 PM   PM User | #15
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,650
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
No, there is no guarantee that there exists a syntactical error with the SQL statement. This alone could be a problem here though: '$subcategory' as it stands out given that its populated from an 'id' could possibly be an integer. MySQL can be configured to strict datatyping.

Given the check on the mysql_query function doesn't produce an error report with the mysql_error indicates to me its not syntactical. My take on the description is that it works when manually entered (presumably using a query directly on the client or with something like PHPMyAdmin).

Based on what I see here and what the described output is, my first suggestion is to open your error reporting up:
PHP Code:
ini_set('display_errors'1);
error_reporting(E_ALL); 
or check your error logs. Any issue indicating a connection failure with the database? Mysql_error when there is no possible error should produce an empty string.

If not, post more code. This isn't by itself (we can see a syntactical fault with a missing end brace if it were by itself), so we cannot tell looking at this that its even possible to reach this branch statement.
Fou-Lu is offline   Reply With Quote