我收到以下錯誤,當我嘗試更新使用mysqli準備語句的查詢。錯誤消息爲何出現意外?任何幫助。準備語句UPDATE
Parse error: syntax error, unexpected '$prob' (T_VARIABLE)
下面是該查詢
$mysqli = new mysqli("localhost", "root", "", "newlogin");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$check = $mysqli->prepare("select * from `vpb_uploads` where `username` = ? and `firstname` = '' and `image_one` != ''");
$check->bind_param('s', $username);
$check->execute();
$check->store_result();
if($check->num_rows < 1)
{
echo '<div class="vpb_error_info" align="left">Sorry, It seems you have not added any file yet.<br>Please click on the Add Files button to first of all add at least one file before submitting your details. Thanks...</div>';
}
else
{
$firstname = trim(strip_tags($_POST["firstname"]));
$lastname = trim(strip_tags($_POST["lastname"]));
if($prob = $mysqli->prepare("update `vpb_uploads` set `firstname` = ?, `lastname` = ? where `username` = ? and `firstname` = '' and `image_one` != ''")
$prob->bind_param('sss', $firstname, $lastname, $username);
$prob->execute();
)
{
echo '<font style="font-size:0px;">success</font>';
echo '<div class="vpb_error_info" align="left">Congrats <b>'.$firstname.' '.$lastname.'</b>, your details have been submitted successfully. Thanks...</div>';
}
我改變它到你寫的東西,但我得到解析錯誤:語法錯誤,意想不到的'{'這是回聲上方 – magnsta 2013-04-08 22:34:39
@magnsta我編輯我的答案,讓我知道它是否適合你。 – vikingmaster 2013-04-08 22:39:35
不,我仍然得到相同的錯誤意外{ – magnsta 2013-04-08 22:47:02