doulai8128
2016-10-08 08:10
浏览 94
已采纳

如何将sql查询的结果输出到php中的屏幕上

The following is the code I use to try and achieve this.

$con=mysqli_connect("localhost:8889","root","root","booksmart_properties");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    else{

        echo "we connected";
    }

    // Perform queries 
    $sql=mysqli_query($con,"SELECT * FROM ListedProperties");
    $result=mysqli_fetch_assoc($sql);



    echo $result['*'];


    mysqli_close($con);

?>

I'm new to php and i'm sure it's something small, I just can't see it.

图片转代码服务由CSDN问答提供 功能建议

以下是我尝试实现此目的的代码。</ p>

   $ con = mysqli_connect(“localhost:8889”,“root”,“root”,“booksmart_properties”); 
 //检查连接
 if(mysqli_connect_errno())
 {
 echo“失败 连接到MySQL:“。  mysqli_connect_error(); 
} 
 else {
 
 echo“we connected”; 
} 
 
 //执行查询
 $ sql = mysqli_query($ con,“SELECT * FROM ListedProperties”);  
 $ result = mysqli_fetch_assoc($ sql); 
 
 
 
 echo $ result ['*']; 
 
 
 mysqli_close($ con); 
 
?&gt; 
 <  / code> </ pre> 
 
 

</ p>

我是php的新手,我确定它很小,我只是看不到它。</ p> </ div>

2条回答 默认 最新

相关推荐 更多相似问题