时间:2021-07-01 10:21:17 帮助过:30人阅读
mysql> insert into user values(‘zhangsan‘,11,‘test....‘); Query OK, 1 row affected (0.01 sec) mysql> update user set name=‘zhangsan‘; Query OK, 0 rows affected (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 0 mysql> update user set username=‘zhangsan‘; ERROR 1054 (42S22): Unknown column ‘username‘ in ‘field list‘
要在PHP中区分上面 第2条 和 第3条SQL语句,使用如下代码:
$conn=mysqli_connect($server_name, $username, $password, $database, $port); $sql = "update user set name=‘zhangsan‘"; $res = mysqli_query($conn,$sql); if(mysqli_error($adsConn)){ echo mysqli_error($adsConn); }else{ echo "OK"; }
PHP判断SQL语句是否合法:mysqli_error()
标签:ase 0.00 war creat ble ... har http mysq