Page 1 of 1

wrong result Resource id #3

Posted: Wed Oct 08, 2008 9:01 pm
by pcb
Hi, i'm new here, just wanna ask a question that make my head itchy. i try google the error i get it, some say i need to use the mysql_fetch_array() or mysql_fetch_assoc() to get the exact value, but none working, any idea how to prevent this? here is my code:

Code: Select all

$querytryakademik = "SELECT applicant_id from personal where ic_baru = $ic2";
   $resultakademik = mysql_query($querytryakademik) or die('<h1>Query failed</h1><br />' . mysql_error() . '<br />' . $querytryakademik);
   while($row = mysql_fetch_array($resultakademik))
        echo $row['applicant_id'];

thank u in advance

Re: wrong result Resource id #3

Posted: Thu Oct 09, 2008 10:30 am
by aceconcepts
Put single quotes around the variable like this:

Code: Select all

$querytryakademik = "SELECT applicant_id from personal where ic_baru ='$ic2'";