I’ve been trying to convert this little script but have gotten stumped (created it mostly from examples)
<?php
$mysqli = new mysqli("localhost","myname","mypwd","thedb");
if ($mysqli -> connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
exit();
}
//mysqli_select_db("mytable", $mysqli);
//$result = mysqli_query("SELECT * FROM blog ORDER BY id DESC LIMIT 4");
$result = $mysqli->query("SELECT * FROM blog ORDER BY id LIMIT 4")
//echo '<table class='blog'>;
while ($row = mysql_fetch_array($result))
{
echo "<table class='blog'>";
echo "<tr>";
echo "<td class='date'><hr>" . $row['date'] . "</td>";
echo "<tr><td class='item'>" . $row['item'] . "</td>";
echo "</tr>";
echo "</table>";
}
mysqli_close($mysqli);
?>
I have it working down to the WHILE statement. The server log says there is a syntax error in that line. The script worked just fine in PHP5 and displayed my blog entries on my private home page. I know this should be easy (and probably is for most of you) but I can’t find an example that works for me. Thanks