phpcmsQQ登陆后用户信息怎么存到数据库

2024-12-27 10:54:25
推荐回答(1个)
回答1:

if(isset($_POST["submit"]) && $_POST["submit"] == "登陆")
{
$user = $_POST["username"];
$psw = $_POST["password"];
if($user == "" || $psw == "")
{
echo "";
}
else
{
mysql_connect("localhost","root","");
mysql_select_db("vt");
mysql_query("set names 'gbk'");
$sql = "select username,password from user where username = '$_POST[username]' and password = '$_POST[password]'";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if($num)
{
$row = mysql_fetch_array($result); //将数据以索引方式储存在数组中
header("location:QA.php");
echo $row[0];

}