Please help I am new to php. I am using mysqli to connect to DB, and want to populate all the records on the form from table.
I am using the following code, but it is using mysql_query function, Can you please if you dfon't mind, can you correct this code to work with mysqli.
Thank you very much.
$connection = new mysqli("localhost", "root", "sa", "onlinedate");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
// Lets select our record fields from our database table and check for results
$sql="SELECT * FROM country";
$mysql_result=mysql_query($sql,$connection);
$num_rows=mysql_num_rows($mysql_result);
echo "<TABLE ALIGN=\"CENTER\" BORDER=\"1\">";
echo "<TR><TH>Record ID</TH><TH>Title</TH><TH>Description</TH></TR>";
while ($row=mysql_fetch_array($mysql_result))
{
$abrev=$row["abrev"];
$name=$row["name"];
// We display the results under the correct headings
echo "<TR><TD>$abrev</TD><TD>$name</TD></TR>";
}