时间:2021-07-01 10:21:17 帮助过:19人阅读
注意数据库的名字,还有连接地址别错了
然后写php文件
$ids = $_POST["ids"]; $name = $_POST["name"]; $source = $_POST["source"]; $price = $_POST["price"]; $numbers = $_POST["numbers"]; $db = new MySQLi("localhost","root","123","mydb"); $sql = "insert into fruit values(‘{$ids}‘,‘{$name}‘, {$price},‘{$source}‘,{$numbers},‘‘)"; if($db->query($sql)){ echo "添加成功!"; }else{ echo "添加失败!"; }
刷新数据库就显示添加成功了。
数据访问(往数据库添加)
标签:mysqli UI for new form col log 添加 div