gpt4 book ai didi

php - $_GET 和 table.php?ini=ABC

转载 作者:太空宇宙 更新时间:2023-11-03 11:01:14 25 4
gpt4 key购买 nike

我正在尝试从用户那里获取输入,然后从表中提取数据并显示它。

我的代码是

$ini = $_GET["ini_id"];
$con=mysqli_connect("localhost","root","","globalgoals");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else

{
$country = array();
//country
$sql="";
//!mysqli_query($con,$sql))
$result = mysqli_query($con,"SELECT * FROM country WHERE metrics="$ini");/*table name*/
while($row = mysqli_fetch_array($result))
{
array_push($country,$row['country']);/*column name*/
}
//

当我输入 url http://localhost/xampp/testing/Int/table.php?ini=C2C

我得到了错误

Notice: Undefined index: ini_id in C:\xampp\htdocs\xampp\Testing\Int\table.php on line 2

最佳答案

获取 $ini = $_GET["ini"]; 因为你没有传递 ini_id

第二

$result = mysqli_query($con,"SELECT * FROM country WHERE metrics='".$ini."'");

关于php - $_GET 和 table.php?ini=ABC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15566151/

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