如何使用 php PDO 从 mysql 数据库中检索和显示数据?这是我的代码。我知道如何使用 mysql_ 函数来做到这一点。这是我尝试过的,但到目前为止它什么也没显示。
#query to display the users
$select_all=("select * from tish_user
inner join tish_clientinfor on tish_user.user_id = tish_clientinfor.user_id
inner join tish_images on tish_user.user_id = tish_images.user_id
inner join tish_security on tish_user.user_id = tish_security.user_id");
$result = $con->query($select_all);
#if the statement is success full
if($result !== false ){
$cols = $result->columnCount();
#echo number of rows
echo 'num rows'.$cols.'</br>';
#pass the result set
foreach($result as $row){
echo $row['username'].'</br>';
}
}
?>