我收到此错误:解析错误:语法错误,第4行/home/csgoxdne/public_html/set.php中的意外'mysqli_set_charset'(T_STRING)
以下是代码:
<?php
$mysqli = new mysqli("localhost:3306", "csgoxdnet", "secretpassword");
if ($mysqli->error) print ("Error connecting! Message: ".$mysqli->error)
mysqli_set_charset($mysqli, 'utf8');
function fetchinfo($rowname,$tablename,$finder,$findervalue)
{($finder == "1");
$query ="SELECT * FROM $tablename WHERE rowname = '$rowname'";
$result = mysqli_query($mysqli, $query);
}
else
{
$query = "SELECT * FROM $tablename WHERE `$finder`='$findervalue'"
if (!$query) {die ('Invalid query: '.$mysqli->error)}
$result = mysqli_query($mysqli, $query);
}
return $result;
老实说,我无法修复错误。感谢您的帮助。
答案 0 :(得分:-3)
使用这种方式
$mysqli->query("SET CHARACTER SET utf8");