gpt4 book ai didi

php - 我不断收到 Unknown column 'Andy' in 'where clause' 错误

转载 作者:行者123 更新时间:2023-11-30 00:18:22 25 4
gpt4 key购买 nike

我已经看过这个问题,但仍然找不到代码中的错误。我使用 Dreamweaver 的自动化功能来执行此操作,因此我根本不明白为什么会收到错误。

我的login.php页面上的代码是:

    if (!isset($_SESSION)) {
session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['first'])) {
$loginUsername=$_POST['first'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "login.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_myStoreConn, $myStoreConn);

$LoginRS__query=sprintf("SELECT `first`, password FROM `admin` WHERE `first`=%s AND

password=%s",
GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $myStoreConn) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}

index.php页面上的代码是:

 $colname_admin = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_admin = $_SESSION['MM_Username'];
}
mysql_select_db($database_myStoreConn, $myStoreConn);
$query_admin = sprintf("SELECT * FROM `admin` WHERE `first` = %s",

GetSQLValueString($colname_admin, "text"));
$admin = mysql_query($query_admin, $myStoreConn) or die(mysql_error());
$row_admin = mysql_fetch_assoc($admin);
$totalRows_admin = mysql_num_rows($admin);

任何人都可以帮忙,这样我就不会用霰弹枪攻击我的 iMac 了吗?!?!

最佳答案

将以下行更改为:

$LoginRS__query = sprintf("SELECT `first`, password FROM `admin` WHERE `first`=%s AND password=%s", GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "text"));

以下内容:

$LoginRS__query = sprintf("SELECT * FROM `admin` WHERE `first`=%s AND password=%s", GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "text"));

关于php - 我不断收到 Unknown column 'Andy' in 'where clause' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23463014/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com