当我尝试使用 mysqli 准备好的语句更新查询时,出现以下错误。错误消息有什么问题,为什么它是意外的?任何帮助。
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>';
}