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 should print the query that is actually getting sent to MySQL Server and you may find errors in the query.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Copying MySQL data

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