sql查询未运行

时间:2017-10-04 18:11:37

标签: php mysql sql

<?php
include"connect.php";

    $name =     $_REQUEST['name'];
    $address =  $_REQUEST['address'];
    $password =     $_REQUEST['password'];
    $email =    $_REQUEST['email'];
    $number =   $_REQUEST['number'];
    $hear =     $_REQUEST['hear'];
    $money =    $_REQUEST['money'];
    $artist =   $_REQUEST['artist'];
    $security = $_REQUEST['security'];
    $city =     $_REQUEST['city'];
    $pro =  $_REQUEST['pro'];
    $role =     $_REQUEST['role'];
    $accname =  $_REQUEST['accname'];
    $accpass =  $_REQUEST['accpass'];
    $accno =    $_REQUEST['accno'];
    $seaccname =    $_REQUEST['seaccname'];
    $seaccpass =    $_REQUEST['seaccpass'];
    $seaccno =  $_REQUEST['seaccno'];
    $contracts = $_REQUEST['contracts'];
    $statements =   $_REQUEST['statements'];

    $result = mysqli_query($con, "insert into signup set name='$name',email='$email',password='$password' ,address='$address',cell_phone_number='$number',heard_from='$hear',money_time='$money',fav_artist='$artist',fav_city='$city',security_question='$security',pro='$pro',pro_acc_name='$accname',pro_acc_password='$accpass',pro_acc_number='$accno',se_acc_name='$seaccname',se_acc_pass='$seaccpass',se_ac_number='$seaccno',rec_contract_copy='$contracts',rec_label_copy='$statements',role='$role'");

//$result= mysqli_query($con, "INSERT INTO signup (name, email,password, address,cell_phone_number, heard_from,money_time, fav_artist,fav_city,security_question, pro,pro_acc_name, pro_acc_password,pro_acc_number, se_acc_name,se_acc_pass, se_ac_number,rec_contract_copy, rec_label_copy,role) VALUES ('$name', '$email', '$password', '$address', '$number', '$hear', '$money', '$artist', '$security', '$city', '$pro', '$role', '$accname', '$accpass', '$accno', '$seaccname', '$seaccpass', '$seaccno', '$contracts', '$statements')");



    if($result==true)
    {
        //echo "<script>alert('user successfully added')</script>";
        echo "Success";

    }
else{

    echo "Failed" ;

}


?>

2 个答案:

答案 0 :(得分:0)

它不会运行,因为您的查询错误,您正在使用带有更新格式的insert语句。

 <select id="ddStatus"  [(ngModel)]="selectedValues[i]" type="number">

以及进一步的信息,开始使用Prepared Statement PDO

答案 1 :(得分:0)

看起来不错。问题可能在connect.php中,或者$ _REQUEST中的名称与发送请求的文件中的名称不同。还要检查要插入的数据库中的属性名称是否与查询中的属性相匹配。