为什么我的php 写不入数据库里面 一直失败 下面是代码?

$con=new mysqli("localhost","root","","classdb");

$con->set_charset('utf8');
if($con->connect_error){
die('连接数据库失败');}

$sql = "insert into student (xuehao,password) vlaues('$email','$password')";
if(mysqli_query($con,$sql)){
echo "成功插入";
}else{echo "插入失败";
}

<?php
$con=new mysqli("localhost","root","","classdb");

$con->set_charset('utf8');
if($con->connect_error){
die('连接数据库失败');}

$sql = "insert into student (xuehao,password) vlaues('".$email."','".$password."')";
if(mysqli_query($con,$sql)){
echo "成功插入";
}else{echo "插入失败";
}
?>

这样试试

追问

一样是失败!

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-04-03
推荐使用PDO连接。mysqli是扩展连接

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网