php - Query did not want to execute -


why query didn't want execute ? can code. time, taking many time resolve this.

here code :

edited

$nim = $_get['nim']; $conn = mysqli_connect($hostname_localhost,$username_localhost,$password_localhost, $database_localhost) or die(mysqli_error($conn)); $query = "select nama_user1,kelas,jurusan user1 kode_user1 = '".$nim."'"; $query_exec = mysqli_query($conn, $query) or die(mysqli_error($conn)); if($data = mysqli_fetch_array($query_exec)) {     $kelas = $data['kelas'];     $jurusan = $data['jurusan'];     $nama = $data['nama'];     echo $nama; } 

while run in mysql , show result query. when execute query didn't show when i'm echo it.

please me.

quick answer $nama = $data['nama']; should $nama = $data['nama_user1'];

longer answer

$query = mysql_prepare($conn, "select nama_user1, kelas, jurusan user1 kode_user1 = ?"); mysqli_stmt_bind_param($query, "i", $nim); mysqli_stmt_execute($query) or die(mysqli_error($conn)); myslqi_stmt_bind_result($query, $nama_q, $kelas_q, $jurusan_q); while(mysqli_fetch_array($query)) {     $kelas = $kelas_q;     $jurusan = $jurusan_q;     $nama = $nama_q;     echo $nama; } 

edit add of stuff post way:

if(isset($_post['nim'])){      $nim = $_post['nim']; } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -