Question

i want to execute a sql at php which does something like changing a text column into int column.

however, this sql failed to fun at php and succeeds in my mysql admin tool (sqlyog). server responses "1 row(s) affected. 1 warning(s)". but "SHOW WARNINGS" didn't pop up anything and not surprisingly, php's mysql_error() didn't return anything.

thanks.

Was it helpful?

Solution

The best is to use the mysqli extension instead of the old mysql extension, as mysqli supports all of MySQL's features and offers the mysqli_get_Warnings() function. Without mysqli you can do mysql_query("SHOW WARNINGS"); (see SHOW WARNINGS docs) and then read the warnings from the result set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top