wrong result Resource id #3

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
pcb
Forum Newbie
Posts: 4
Joined: Thu May 10, 2007 6:38 am

wrong result Resource id #3

Post 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
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: wrong result Resource id #3

Post by aceconcepts »

Put single quotes around the variable like this:

Code: Select all

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