经测试代码如下:
<?PHP
/**
* 查询MysqL数据库prepare语句
*
* @param
* @arrange (512.笔记) jb51.cc
**/
$MysqL = new MysqLi('localhost','root','databaseName') or die('There was a problem connecting to the database');
$stmt = $MysqL->prepare('SELECT id,title,content FROM tableName');
$stmt->execute();
$stmt->bind_result($id,$title,$content);
while($row = $stmt->fetch()) : ?>
<h2> <?PHP echo $title; ?> </h2>
<p> <?PHP echo $content; ?> </p>
<?PHP endwhile; ?>