最近,随着php 7的更新,他们删除了所有的mysql命令。但是,我实习的一个程序是在其中一个页面中使用这些命令。然而,当我把它改成mysqli它不再像它应该的那样工作。有人可能会帮忙吗?
$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 亲切的问候, Dayne Tersluijsen
答案 0 :(得分:0)
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given:
mysqli_select_db("prodyne", $con);
要强>
mysqli_select_db($con, "prodyne")
试一试!
<?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;
}
我希望这对你有帮助。