//name length
if(strlen($name)>100 || strlen($name)<3)
exit("name must be <3 and >100");
//message length
if(strlen($message)>100 || strlen($message)<3)
exit("message must be <3 and >100");
$date = date("d-m-y");
//Database
$connection= mysqli_connect('localhost','root','','zatona');
$querycheck=mysqli_query($connection,'INSERT INTO `message`(`name`, `message`, `date`) VALUES ('C:\\wamp\\www\\1\\{$name}', '$message', '$date')');
if($querycheck == true)
{
//message
echo "message added";
}
else{
//error message
echo "Error adding new message";
}
mysqli_close($connection);
}
,但它給錯誤語法錯誤:我創建的代碼在PHP,低於
unexpected '$name' (T_VARIABLE)
怎樣纔可以解決?使用WAMP服務器
,不會與mysqli的參數,結合存在的問題。 – mario