Return to Snippet

Revision: 27864
at June 25, 2010 07:51 by Nettuts


Updated Code
$mysql = new mysqli('localhost', 'root', '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; ?>

Revision: 27863
at June 25, 2010 07:45 by Nettuts


Initial Code
$mysql = new mysqli('localhost', 'root', '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; ?>

Initial URL


Initial Description


Initial Title
Prepared Statements: Read

Initial Tags
sql, php

Initial Language
PHP