MySQL Forums
Forum List  »  PHP

Re: MySQLi
Posted by: Peter Brawley
Date: April 13, 2006 02:22PM

<html><body>
Substitute your USR, PWD, db & query values:

<?php
$link = mysqli_connect('localhost', 'USR', 'PWD', 'sakila')
or die('Could not connect: ' . mysqli_error());
$res = mysqli_query( $link, "SELECT * FROM sakila.category" )
or die( mysqli_error($link) );
$cols = mysqli_num_fields($res);
$rows = mysqli_num_rows($res);
echo "<table><br/>";
while ($row = mysqli_fetch_array( $res )) {
echo "<tr>\n ";
for( $i = 0; $i < $cols; $i++ ) {
echo " <td>$row[$i]</td>";
}
echo "\n</tr>\n";
}
echo "</table>\n";
mysqli_close($link);
?>
</body></html>

Options: ReplyQuote


Subject
Written By
Posted
April 13, 2006 02:10PM
Re: MySQLi
April 13, 2006 02:22PM
April 14, 2006 05:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.