gpt4 book ai didi

第 6 行的 PHP 解析错误...似乎是我忽略的简单问题。

转载 作者:搜寻专家 更新时间:2023-10-31 21:13:48 24 4
gpt4 key购买 nike

<分区>

我在创建简单的登录表单时遇到了问题。任何人都可以解释为什么 SQL 说“解析错误:语法错误,意外的 '$username' (T_VARIABLE) in C:\xampp\htdocs\Easy Grade 2000\login.php on line 6”以及如何修复它?

谢谢

<?php

include 'connect.php'

// username and password sent from form
$username = $_POST['u_name'];
$password = $_POST['p_word'];

$sql="SELECT * FROM $db_name WHERE u_name='$username' and p_word='$password'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>

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