<?php
$i = new mysqli('localhost', 'username', 'password', 'database');
if ($result = $i->query("SELECT * FROM tablename;") )
{
printf("Select returned %d rows.\n", $result->num_rows);
if ($result->num_rows > 0)
{
while ($row = $result->fetch_object())
{
print_r($row);
}
}
$result->close();
}
else
{
printf("%d : %s\n", $i->errno, $i->error);
}
?>
if (!$i->query("INSERT INTO table VALUES(null, 'x','x','x');" ) )
{
/* Handle Error */
}
or
if ($i->query("INSERT INTO table VALUES(null, 'x','x','x');" ) )
{
/* Handle Success */
}
else
{
/* Handle Error */
}