i got mysql_fetch_array() error while fetching the data from the DB. i already try the SQL at phpmyadmin, the query works just fine. but when opening the php page, the query not working. i dont know what the reason. there's no error shown at the page. no data shown at the page either, only the table.
FYI, these codes are for Parent viewing the specific student record (their child). i specify the user using session username.
thanks in advance!
`
<table border="1" width="1050px" align="center" cellpadding="3" class="mytable" cellspacing="0">
<tr>
<th>No</th>
<th>Student ID</th>
<th>Student Name</th>
<th>Gender</th>
<th>Date of Birth</th>
<th>Parent's Name</th>
<th>Parent's IC</th>
<th>Address</th>
<th>Phone</th>
<th>E-mail</th>
<th>Class</th>
<th colspan="2">Update</th>
</tr>
<?php
$sql_parent=mysql_query("SELECT stu_id,stu_name,gender,dob,parent_name,parent_ic,address,phone,email,class_name FROM stu_tbl A, users_tbl B WHERE A.parent_ic = B.icnum AND B.username = '.$_SESSION[username]'");
if($sql_parent === FALSE) {
die('could not get data'.mysql_error()); }
$i=0;
while($row=mysql_fetch_array($sql_parent)){
$i++;
$color=($i%2==0)?"lightblue":"white";
?>
<tr bgcolor="<?php echo $color?>">
<td><?php echo $i;?></td>
<td><?php echo $row['stu_id'];?></td>
<td><?php echo $row['stu_name'];?></td>
<td><?php echo $row['gender'];?></td>
<td><?php echo $row['dob'];?></td>
<td><?php echo $row['parent_name'];?></td>
<td><?php echo $row['parent_ic'];?></td>
<td><?php echo $row['address'];?></td>
<td><?php echo $row['phone'];?></td>
<td><?php echo $row['email'];?></td>
<td><?php echo $row['class_name'];?></td>
<td><a href="?tag=parent_update&opr=upd&rs_id=<?php echo $row['stu_id'];?>" title="Update"><img src="picture/update.png" /></a></td>
</tr>
<?php
}
?>
`