如下文为我做的php文件,可是我试验过数据库里没有数据输入,求大神指导。
<?php$conn=mysql_connect("localhost","zcinfo","");$action=$_POST['action'];if($action...
<?php
$conn=mysql_connect("localhost","zcinfo","");
$action = $_POST['action']; if($action == 'send')
{
mysql_query("set names utf8");
$name=$_POST['name'];
$gender=$_POST['gender'];
$schnum=$_POST['schnum'];
$pro=$_POST['pro'];
$tel=$_POST['tel'];
mysql_select_db("zcinfo",$conn);
$sql="insert into zc_stu(name,sex,pro,tel,schnum) values ('".$name."','".$gender."','".$pro."','".$tel."','".$schnum."')";
$result= mysql_query($sql,$conn);
}
?>
哪里错了?
我用的是wamp搭建环境 展开
$conn=mysql_connect("localhost","zcinfo","");
$action = $_POST['action']; if($action == 'send')
{
mysql_query("set names utf8");
$name=$_POST['name'];
$gender=$_POST['gender'];
$schnum=$_POST['schnum'];
$pro=$_POST['pro'];
$tel=$_POST['tel'];
mysql_select_db("zcinfo",$conn);
$sql="insert into zc_stu(name,sex,pro,tel,schnum) values ('".$name."','".$gender."','".$pro."','".$tel."','".$schnum."')";
$result= mysql_query($sql,$conn);
}
?>
哪里错了?
我用的是wamp搭建环境 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询