我的SQL语法遇到问题,我希望它以字符串形式返回,或者至少显示语法结果。
我的代码是:
<?php
$host='localhost';
$user='root';
$password='';
$db='employee101';
$PLATE_NUM = 'ABC123';
$sql = "select * from employee_data where PLATE_NUM like '$PLATE_NUM';";
$con = mysqli_connect($host,$user,$password,$db);
$result = mysqli_query($con, $sql);
$response = array();
$myText = (string)$result;
$row = mysql_fetch_array($result);
echo $result->fetch_object()->memTotal;
mysqli_close($con);
?>
我得到的错误:
捕获致命错误:第17行的C:\ wamp64 \ www \ 666.php中无法将类mysqli_result的对象转换为字符串