更新查询更新不起作用

时间:2014-10-08 10:52:03

标签: php html mysql mysqli

任何人都可以帮我找到错误。 我正在尝试进行更新查询,但它不起作用。 我检查了数据库列名,GET值,但它仍然不起作用。

<?php 

require_once("inc/db_const.php");

$id_cl=mysql_real_escape_string(stripslashes($_GET['id_cl']));
$nom_respo=mysql_real_escape_string(stripslashes($_GET['nom_respo']));
$email_respo=mysql_real_escape_string(stripslashes($_GET['email_respo']));
$id_tp_contact=mysql_real_escape_string(stripslashes($_GET['id_tp_contact']));
$sect_id=mysql_real_escape_string(stripslashes($_GET['sect_id']));
$ent_name=mysql_real_escape_string(stripslashes($_GET['ent_name']));
$apropos=mysql_real_escape_string(stripslashes($_GET['apropos']));

$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);

# check connection
if ($mysqli->connect_errno) {
    echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>";
    exit();
}
$query = "UPDATE client_tb SET nom_respo = ? ,email_cl = ? , id_tp_contact = ? , sect_id = ? , cmp_name = ? , apropos_cl = ? WHERE id_cl =? ";
$statement = $mysqli->prepare($query);
$results =  $statement->bind_param('ssiissi', $nom_respo, $email_respo, $id_tp_contact,$sect_id,$ent_name,$apropos,$id_cl);
if($results){
    print 'Success! record updated';
}else{
    print 'Error : ('. $mysqli->errno .') '. $mysqli->error;
}

 ?>

0 个答案:

没有答案