尝试获取特定外键的信息

i am new in php and mysql. I am trying to fetch information from one of my table. Just give you the information about my table. Name of my table is leave.it contaning one foreign key namely leaveId.

    lid     empname     username    nod     date     reason  action leaveID 
    ===     =======     ========    ===     =====    ======  ====== =======
     1      Maxwell       max        1       2012     Null   Denied    3
     2      Ponting      punter      1       2011     Null   Denied    4
     3      Ponting      punter      2       2011     xam    Accepted  4
     4      Taylor       tayl        1       2011     Null   Accepted  1

now as example is there any sql query to retrieve only the information of Pointing whom leaveId is 4. I wrote the following query..

$leave = mysql_query("SELECT * FROM `leave` where leaveID = $user ");

but it only return the 2nd row associated with the number 4 leaveId where it should return the both 2nd and 3rd row,isn't it?? . Actually i am not sure...if it is wrong then give me the right answer to(as example) how can i fetch the information of ponting whom leaveID is 4.

you need to get your rows with a while loop

$leave = mysql_query("SELECT * FROM `leave` where leaveID = $user ");
while ($row = mysql_fetch_array($leave, MYSQL_NUM)) {
    printf(" ID:", $row[0], "empname ", $row[1]);  
}