2014-04-10 87 views
0
$query = "INSERT INTO patients (username, idn, email, mobilenumber, healthcenter, height, weight, city, state) 
    VALUES (:name, :id, :mail, :mn, :hc, :heightv, :weightv, :cityv, :statev) "; 

//Again, we need to update our tokens with the actual data: 

$query_params = array(
    ':name' => $_POST['username'], 
    ':id' => $_POST['idn'], 
    ':mail' => $_POST['email'], 
    ':mn' => $_POST['mobilenumber'], 
    ':hc' => $_POST['healthcenter'], 
    ':hightv' => $_POST['height'], 
    ':weightv' => $_POST['weight'], 
    ':cityv' => $_POST['city'], 
    ':statev' => $_POST['state'] 
); 

//time to run our query, and create the user 

try { 
    $stmt = $db->prepare($query); 
    $result = $stmt->execute($query_params); 
} 
+8

在query_params你拼寫錯誤heightv – marcosh

+0

什麼錯誤? –

+1

@ chinna_82糾正typp' ':hightv'=> $ _ POST [ '高度']''到 ':heightv'=> $ _ POST [ '高度'],' – Sirko

回答

2

在你query_params你拼寫錯誤heightv

您應該使用

':heightv' => $_POST['height'], 

,而不是

':hightv' => $_POST['height'], 
+0

謝謝marcosh它現在的工作 – user3035693