MySQL Trouble shooting

Try checking for Typos by printing out the query that is getting sent to MySQL Server from your code.

For example if you MySQL Code looks like:

 

$query = 'SELECT * FROM t4 WHERE f1 IN(';
for ($i = 1; $i < 101; $i ++)
$query .= "'row$i,";
$query = rtrim($query, ',');
$query .= ')';
$result = mysql_query($query);

 

Try adding echo $query; into the code like this:

$query = 'SELECT * FROM t4 WHERE f1 IN(';
for ($i = 1; $i < 101; $i ++)
$query .= "'row$i,";
$query = rtrim($query, ',');
$query .= ')';
echo $query;
//$result = mysql_query($query);

This shold print the query that is actually getting sent to MySQL Server and you may find errors in the query.

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

500 Error: File is writeable by group

On occasion you may get a 500 page error (a green/blue error page) when trying to run a PHP...

Temp URLs

Sometimes Modules and Addons like those for Wordpress can have issues with the Tilda (~) that is...

Copying MySQL data

To copy a table structure and all of its data: CREATE TABLE new_table LIKE old_table;INSERT INTO...