在php和mysql中规范化数据

时间:2017-11-16 09:25:31

标签: php mysql database-normalization

我想对我拥有的数据进行规范化

我编写了以下代码,但它总是用0填充数据库,它显示以下错误消息。致命错误:未捕获的异常您的sql语法错误

var url = "Project.aspx?customerid=" + customerId + "&table1Number=" + table1Number;

updateElementsById(url, "#table2", "#table3");

任何帮助?

1 个答案:

答案 0 :(得分:1)

更新

 $mysqli = new mysqli($hostname, $username, $password, $dbname);
    $customer_id='Your_Customer_Id';
    $query = "SELECT score from score where customer_id =?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param("s", $customer_id);
    $stmt->execute();
    $res = $stmt->get_result();
    $data = $res->fetch_all();;

此代码使用预准备语句。它更安全,并确保您不会逃避您的查询。您的代码中的问题是您使用的双引号是转义您的查询。这就是错误的来源。请查看prepared statements

的此链接