[thelist] MySQL Error in PHP but not SQLYog

Fred Jones fredthejonester at gmail.com
Wed Mar 5 05:03:12 CST 2008

I have code that was working before and today it fails. MySQL returns an 
error, so I echo mysql_errno() and see only:


which should be this:

# Error: 1406 SQLSTATE: 22001 (ER_DATA_TOO_LONG)

Message: Data too long for column '%s' at row %ld

I also echo the SQL I was trying to execute. My code is this:

	$my_result = mysql_query($sql);
	if (0 == $my_result)
		echo "\n\n ERROR: ".mysql_errno()."\n for:\n $sql \n\n";

so I am quite certain that the SQL echoed is the same that generated the 
error. The odd thing is that if I run the SQL (that same SQL) using 
SQLYog [1] which is just another client to connect to MySQL, it runs 
fine with no error, and I can confirm that the UPDATE worked.

I have never seen such a thing. I am a bit stuck. Any ideas?


[1] http://www.webyog.com/en/

More information about the thelist mailing list