我无法定义变量来更新我的数据库

时间:2014-12-07 12:02:29

标签: php

这是代码:

<?php
include "../include/koneksi_db.php";
include "../user/link.php";     
$query=mysql_query("SELECT * FROM admin WHERE id=$id", $konek);
$hasil=mysql_fetch_array($query);
$id  =$hasil['id'];
$user=$hasil['username'];
$pass=$hasil['password'];
$hak =$hasil['hak_akses'];
?>

问题:  如何解决这个问题:Nocticce:未定义的变量:第5行的C:.... \ ed_user.php中的id

1 个答案:

答案 0 :(得分:0)

不确定我是否理解正确:这个?

<?php
include "../include/koneksi_db.php";
include "../user/link.php";

 $check_the_query = "SELECT * FROM admin WHERE id='".$id."'";
$query=mysql_query(, $konek);

while($hasil=mysql_fetch_array($query)){
    $id  =$hasil['id'];
    $user=$hasil['username'];
    $pass=$hasil['password'];
    $hak =$hasil['hak_akses'];

    echo "id -> ".$id."<br>";
    echo "user -> ".$id."<br>";
    echo("<br>");
}

?>