最新版本的 localhost (vertrigo_230) 中的变量未定义错误
Variables undefined error in latest version of localhost (vertrigo_230)
下面提到的 PHP 代码在 vertrigo_222(以及 livehost)上是完美的。
现在我正在尝试将本地主机升级到 vertrigo_230。
我面临以下未定义变量错误或警告:
这是代码(提到第 30 行):
<?php
ob_start();
session_start();
include_once("PHP_Code/db_connection.php");
if(isset($_REQUEST['data']))
$data = $_REQUEST['data'];
//Fetch All Important Information from Database in Variables
if($_SESSION['id'] && $_SESSION['pw']) //Login Must for This Informatiion
{
if(isset($_REQUEST['city_id']))
{
if($_REQUEST['city_id'])
{
$city_id = $_REQUEST['city_id'];
}
else
{
$query = "SELECT * FROM cities WHERE user_id = '$_SESSION[id]'";
$c = mysql_query($query) or die(mysql_error()." in query $query");
$city = mysql_fetch_array($c);
$city_id = $city['city_id'];
}
//Setting Current/Opened City in Session
$_SESSION['city_id'] = $city_id;
}
}
//Secure Page
if($data == "") //Line # 30
$data = "loginPage";
请给我一些解决方案。
将 $data
定义为全局变量,您必须使用 mysqli
insted 因为 mysql
已正式弃用
ob_start();
session_start();
include_once("PHP_Code/db_connection.php");
$data = '';
//your code
下面提到的 PHP 代码在 vertrigo_222(以及 livehost)上是完美的。
现在我正在尝试将本地主机升级到 vertrigo_230。
我面临以下未定义变量错误或警告:
<?php
ob_start();
session_start();
include_once("PHP_Code/db_connection.php");
if(isset($_REQUEST['data']))
$data = $_REQUEST['data'];
//Fetch All Important Information from Database in Variables
if($_SESSION['id'] && $_SESSION['pw']) //Login Must for This Informatiion
{
if(isset($_REQUEST['city_id']))
{
if($_REQUEST['city_id'])
{
$city_id = $_REQUEST['city_id'];
}
else
{
$query = "SELECT * FROM cities WHERE user_id = '$_SESSION[id]'";
$c = mysql_query($query) or die(mysql_error()." in query $query");
$city = mysql_fetch_array($c);
$city_id = $city['city_id'];
}
//Setting Current/Opened City in Session
$_SESSION['city_id'] = $city_id;
}
}
//Secure Page
if($data == "") //Line # 30
$data = "loginPage";
请给我一些解决方案。
将 $data
定义为全局变量,您必须使用 mysqli
insted 因为 mysql
已正式弃用
ob_start();
session_start();
include_once("PHP_Code/db_connection.php");
$data = '';
//your code