从PHP打印MySQL查询结果
我试图从表中获取一些数据并打印或仅使用这些数据。 两者都做不到从PHP打印MySQL查询结果,php,mysql,Php,Mysql,我试图从表中获取一些数据并打印或仅使用这些数据。 两者都做不到 $con=mysqli_connect($MySQL_Host,$MySQL_User,$MySQL_Password,$MySQL_DB); function echo_func_test ($db_con,$INPUT_IndustryName){ $result = mysqli_query($db_con,"SELECT ID FROM Industries where IndustryName = '$INPUT_Ind
$con=mysqli_connect($MySQL_Host,$MySQL_User,$MySQL_Password,$MySQL_DB);
function echo_func_test ($db_con,$INPUT_IndustryName){
$result = mysqli_query($db_con,"SELECT ID FROM Industries where IndustryName = '$INPUT_IndustryName'");
//$Data = mysql_fetch_row($result);
var_dump ($result);
}
$IndustryName = Utilities;
echo_func_test($con,$IndustryName);
=================
the output is:
mysqli_result::__set_state(array(
'current_field' => NULL,
'field_count' => NULL,
'lengths' => NULL,
'num_rows' => NULL,
'type' => NULL,
)) root@virtual-dev:/home/ftpadmin/FirstPHP2# php Scripts/main.php
我做错了什么?您需要在
mysqli\u query()之后调用$industryName='Utilities'
。开发时需要打开错误日志和/或错误显示。您还应该确保在运行查询时正在测试边缘情况。让suire你的连接工作,如果不处理它。确保你的查询工作正常,如果不处理它,等等。最重要的是:开始阅读文档!如果你不知道事物是如何使用的,你如何期望得到正确的结果?