這是我目前的說法。一切工作正常,直到我添加了密鑰Prepare Statement發送加密信息的問題
密鑰只是用戶激活帳戶的生成散列。
$stmt = $mysqli->prepare("INSERT INTO Account (accountUsername,accountPassword,accountEmail,accountActivate,accountKey) VALUES (?, ?, ?,?,?)");
$stmt->bind_param('sssiss', $username, $newPassword, $email,0,$key,time());
當我這樣做代碼時,我收到一個錯誤。
不能借
你知道可能是什麼問題傳遞參數5?
謝謝!
編輯代碼:
$stmt = $mysqli->prepare("INSERT INTO Account (accountUsername,accountPassword,accountEmail,accountActivate,accountKey,accountCreated) VALUES (?, ?, ?,?,?,?)");
$stmt->bind_param('sssisi', $username, $newPassword, $email,0,$key,$time);
http://i.stack.imgur.com/Th5tl.png
'「0」'需要作爲變量,通過數目要傳遞的字符串,表明你有一些嚴重的數據庫問題,如不能正常使用的字段類型MySQL提供您存儲數據。 – Prix 2014-10-18 21:31:34
我可以改變,但這不是問題。 – 2014-10-18 21:34:38
這正是問題所在,不僅僅是將其從「0」改爲「0」,它需要作爲變量又名「$ val = 0;」,如果數據庫列中沒有使用「0」類型是'string'而不是'int',這就是我沒有使用正確的數據庫字段類型的含義。一個很好的例子就是使用一個字符串來存儲一個日期/時間字段,這會讓你失去使用適當字段類型「DATETIME」的很多好處。 – Prix 2014-10-18 21:39:30