Php 登录系统帮助-“获取4个错误”
当我尝试使用该系统时,会出现这些错误 在C:\wamp\www\UCP\header.inc.php的第16行使用未定义的常量session\u id-假定为“session\u id” mysql\u fetch\u assoc希望参数1是资源,布尔值在第21行的C:\wamp\www\UCP\header.inc.php中给出 mysql\u num\u rows期望参数1是资源,布尔值在第22行的C:\wamp\www\UCP\header.inc.php中给出 :在第3行的C:\wamp\www\UCP\Dashboard.php中使用未定义的常量IsLoggedIn-假定为“IsLoggedIn”Php 登录系统帮助-“获取4个错误”,php,mysql,session,login,system,Php,Mysql,Session,Login,System,当我尝试使用该系统时,会出现这些错误 在C:\wamp\www\UCP\header.inc.php的第16行使用未定义的常量session\u id-假定为“session\u id” mysql\u fetch\u assoc希望参数1是资源,布尔值在第21行的C:\wamp\www\UCP\header.inc.php中给出 mysql\u num\u rows期望参数1是资源,布尔值在第22行的C:\wamp\www\UCP\header.inc.php中给出 :在第3行的C:\wamp
基本上,考虑将其写入PDO或MySQL中,至少是因为MySQL查询被折旧了。但在这种情况下:
1) $sessID = session_id();
2) the mistake is here ---> WHERE session_id = '$sessID' AND hash= '$hash' AND expires > " . time(). ""); First, you INSERT Hash and SESSION_id TO DB and then you SELECT it.
3) $num=mysql_num_rows($query);
if($num !==0 ) {
}
4) mysql_query("UPDATE active_users SET expires = '$expires' WHERE user='$user'");
5) if($user !==null)
6) if you still receiving errors, check if row & table names are correctly written.
在查询中,使用SELECT更改SLECT时,SQL查询中存在拼写错误
在IsLoggedIn函数中将SLECT改为SELECT,并始终使用`to pack table或field name.我刚刚遇到这个错误,现在使用未定义的常量IsLoggedIn-假定为`IsLoggedIn`是的,仅此一次使用未定义的常量IsLoggedIn-假定为`IsLoggedIn`这是否正确?错误在于2删除WHERE子句以检查它,然后重新考虑子句检查是否有正确写入的列:user、session\u id、hash、expires。然后检查expires是否具有整数类型。还可以尝试:$data=mysql\u fetch\u array$query;函数可以放置在任何位置,而不是ASSOC
1.Use of undefined constant session_id: define your session_id
2. For mysql error just change SLECT with SELECT
3. Use of undefined constant IsLoggedIn : pull your IsLoggedIn function in the top of the page.
1.Use of undefined constant session_id: define your session_id
2. For mysql error just change SLECT with SELECT
3. Use of undefined constant IsLoggedIn : pull your IsLoggedIn function in the top of the page.