我有以下连接文件...
<?php
session_start();
// Create new mysql connection object
$DBConnect = @new mysqli("localhost","root","","Ladle");
?>
我将其包含在以下脚本中...
<?php ob_start() ?>
<?php session_start() ?>
<?php
//Connects to the database
include("inc_LadleDB.php");
$this->DBConnect = $DBConnect;
// Get the e-mail address entered
$email = $_POST['user_email'];
$sql = $this->DBConnect->mysql_query("SELECT * FROM tblEmployees WHERE fldEmail='".
$email."'") or die(mysql_error());
$Result = mysql_fetch_assoc($sql);
//validate email fo valid maine account
if($Result)
{ ...
我尝试运行它,但出现“不在对象上下文中使用 $this”的错误;我只需要执行简单的查询,不想处理 OO PHP,但现在 mysql 已被弃用,我别无选择。如何引用包含的连接文件以在此无 OO 文件中运行 SELECT 查询?