Php 传递的未定义索引ID

Php 传递的未定义索引ID,php,Php,编辑_accounts.php 试试这个, 替换: $query=mysqli_query($dbcon,"select * from users_tbl where id ='$get_id'")or die(mysqli_error()); 到 删除单引号。它没有取代它的价值 请让我知道这是否适合您。您应该检查,它是否返回结果或否。 如果数据库中没有正确的ID,则可能出现此错误 $query=mysqli_query($dbcon,"select * from users_tbl

编辑_accounts.php


试试这个,
替换:

  $query=mysqli_query($dbcon,"select * from users_tbl where id 
='$get_id'")or die(mysqli_error());

删除单引号。它没有取代它的价值


请让我知道这是否适合您。

您应该检查,它是否返回结果或否。 如果数据库中没有正确的ID,则可能出现此错误

$query=mysqli_query($dbcon,"select * from users_tbl where id ='$get_id'")or die(mysqli_error());
if (!($row=mysqli_fetch_array($query))) {
    echo "Can not find user";
    exit();
}
$id=$row['id'];

附言:花时间学习准备好的陈述。不要使用向SQL查询传递参数的方式。在这种情况下,SQL注入非常容易。

请显示整个“edit_accounts.php”的可能副本。例如,通过“更新”按钮提交的表格。已经更改了!表单的
action=“update\u accounts.php”
正确吗?然后也显示
update\u accounts.php
。@aenderei你做到了,兄弟!我实际上看到,当你说显示整个编辑账户时,你可以添加评论,兄弟!相同的错误“注意:未定义的索引:ID在C:\WAMP64\WWW\DTRNEW\ADMIN\EDIT\u ACCOUNTS.PHP的第3行,并添加了另一个错误”警告:MYSQLI\u error()只需要1个参数,0在C:\WAMP64\WWW\DTRNEW\ADMIN\EDIT\u ACCOUNTS.PHP的第9行中给出”,第9行是我删除aendeerei所说get idAs中的“”的地方,你能给我看一下吗编辑_accounts.php”表单
  $query=mysqli_query($dbcon,"select * from users_tbl where id 
='$get_id'")or die(mysqli_error());
  $query=mysqli_query($dbcon,"select * from users_tbl where id 
=$get_id")or die(mysqli_error());
$query=mysqli_query($dbcon,"select * from users_tbl where id ='$get_id'")or die(mysqli_error());
if (!($row=mysqli_fetch_array($query))) {
    echo "Can not find user";
    exit();
}
$id=$row['id'];