我在向数据库添加结果时遇到问题。这是我的链接代码。
$startingunix = strtotime($dates . " " . $startingtime); //
$endingunix = strtotime($dates . " " . $endingtime);
$servername = "localhost";
$username = "x";
$password = "x";
$dbname = "josfei6_ge";
// Create connection
$connection = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}
date_default_timezone_set("America/Los_Angeles");
global $mysqli;
$sql="SELECT * FROM `events` WHERE `description` = '$desc' ORDER BY starttime;";
$records=mysqli_query($connection, $sql);
$numberofevents = 0;
$okay = 0;
while($eventnow=mysqli_fetch_assoc($records)){}
当我尝试向数据库添加数据时出现错误:
$dbconnection->query($sql);
它给我一个错误:
fatal error: Call to a member function query() on a non-object
有人有建议吗?