gpt4 book ai didi

PHP 插入空白值而不是 GET 值

转载 作者:行者123 更新时间:2023-11-29 10:56:05 25 4
gpt4 key购买 nike

我的网站上有这个脚本:

<?php

$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

if($db_found) {
$SQL = "INSERT INTO users (user, address)
VALUES('".$_GET['username']."','".$_GET['password']."')";

$result = mysql_query($SQL);

mysql_close($db_handle);
print "Records added to the database";
}
else {
print "Database NOT found";
mysql_close($db_handle);
}
?>

然后我在浏览器中打开此网址:

http://ringkapps.altervista.org/addToDatabase.php?user=ringk&address=test

但是它不是在表中插入“ringk”和“test”,而是插入以下内容:

enter image description here

不明白为什么,任何帮助将不胜感激。

最佳答案

这段代码是错误的!

$SQL = "INSERT INTO users (user, address)
VALUES('".$_GET['username']."','".$_GET['password']."')";

替换这个。

$SQL = "INSERT INTO users (user, address)
VALUES('".$_GET['user']."','".$_GET['address']."')";

关于PHP 插入空白值而不是 GET 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43001953/

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