简体   繁体   中英

how do i get mysql warning messages in php (not error)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM