So recently with the php 7 update they removed all the mysql commands. however one of my programs for my internship was using such commands in one of the pages. however when i change it to mysqli it no longer works like it should. can someone help perhaps?
$connection = mysqli_connect($db_host, $db_username, $db_password) or die("Error " . mysqli_error());
//select MySQLi dabatase table
$db = mysqli_select_db($connection, "table") or die("Error " . mysqli_error());
$result = mysqli_query($connection, "SELECT * FROM gebiedsmanagers WHERE Datum >= NOW()");
Pastebin code With kind regards, Dayne Tersluijsen
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given:
mysqli_select_db("prodyne", $con);
To
mysqli_select_db($con, "prodyne")
Try this out!
<?php
//MySQLi information
$db_host = "localhost";
$db_username = "username";
$db_password = "password";
//connect to mysqli database (Host/Username/Password)
$connection = mysqli_connect($db_host, $db_username, $db_password) or die("Error " . mysqli_error());
//select MySQLi dabatase table
$db = mysqli_select_db($connection, "table") or die("Error " . mysqli_error());
//fetch information from your database
$result = mysqli_query($connection, "SELECT * FROM gebiedsmanagers WHERE Datum >= NOW()");
while($row = mysqli_fetch_array($result))
{
$counter ++;
?>
<tr><td><?php echo date('d-m-Y', strtotime($row['Datum']));?></td><td>
<?php echo $row['Voor1500']; ?></td><td><?php echo $row['Na1500']; ?>
</td></tr>
<?php
if($counter >= 120) {
break;
}
I hope this has helped you.