php,mysql插入报错
直接在mysql里插入这句就没问题...写到php里就报错说Warning: mysqli_query() expects at least 2 parameters, 1 given in D:\xampp\htdocs\ca\connect.php on line 12
错误里的line 12指的是php代码里的$res=mysqli_query($sql);这行
<?php<br />$mysql=mysqli_connect("localhost","root","","leo");<br />$sql="insert into doc (name,size,loc) values('name1','size1','loc1')";<br />$res=mysqli_query($sql);<br />if($res===TRUE)<br />{<br /> echo '插入完成';<br /> }<br /> else echo '插入失败';<br /> mysqli_close($mysql);<br />?>
<br />mysqli_query($mysql,$sql);//必须要2个参数<br />