This is my code for pagination page. My problem are
(Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\wamp\www\example\pagination.php on line 48) and (Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\wamp\www\example\pagination.php on line 103)
Bold sentences are problem. Any suggestion or solution you may give me for this problem. Thanks :)
if(isset($_GET['page']))
{
$page = $_GET['page'];
}
else
- List item
{
$page = 1;
}
$sf = ($page-1) * 10;
$sql = "SELECT d.last_name, d.first_name, d.middle_name, d.title,
c.clinic_name, c.address, s.work_day, s.start_time, s.end_time, ss.specialization
FROM schedule s
LEFT JOIN clinic c on c.clinic_id = s.clinic_id
LEFT JOIN doctor_has_specialization dhs on dhs.doctor_id = dhs.doctor_id
LEFT JOIN specialization ss on ss.specialization_id = dhs.specialization_id
LEFT JOIN doctor d on d.doctor_id = dhs.doctor_id LIMIT ".$sf.",10";
$rs = mysql_query($sql,$con);
//echo $rs;
?>
<html>
<head>
<title>Pages</title>
</head>
<body>
<?php
$sql1 = "SELECT count(d.last_name, d.first_name, d.middle_name, d.title,
c.clinic_name, c.address, s.work_day, s.start_time, s.end_time, ss.specialization)
FROM schedule s
LEFT JOIN clinic c on c.clinic_id = s.clinic_id
LEFT JOIN doctor_has_specialization dhs on dhs.doctor_id = dhs.doctor_id
LEFT JOIN specialization ss on ss.specialization_id = dhs.specialization_id
LEFT JOIN doctor d on d.doctor_id = dhs.doctor_id";
$rs1 = mysql_query($sql1,$con);
***$row1 = mysql_fetch_row($rs1);***
$total = $row1[0];
$tp = ceil($total/10);
for($i = 1; $i <= $tp; $i++)
{
echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
}
?>
<table>
<tr>
<th> Middlename </th>
<th> Lastname </th>
<th> Doctor Title </th>
<th> Specialization</th>
<th> Clinic Name</th>
<th> Clinic Address</th>
<th> Work Day/s</th>
<th> Start Time</th>
<th> End Time</th>
</tr>
<?php
while($row = mysql_fetch_assoc($rs))
{
?>
<tr>
<td><?php echo $row['first_name']; ?></td>
<td><?php echo $row['middle_name']; ?></td>
<td><?php echo $row['last_name']; ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['specialization']; ?></td>
<td><?php echo $row['clinic_name']; ?></td>
<td><?php echo $row['address']; ?></td>
<td><?php echo $row['work_day']; ?></td>
<td><?php echo $row['start_time']; ?></td>
<td><?php echo $row['end_time']; ?></td>
</tr>
<?php
}
?>
</table>
<?php
$sql1 = "SELECT count(d.last_name, d.first_name, d.middle_name, d.title,
c.clinic_name, c.address, s.work_day, s.start_time, s.end_time, ss.specialization)
FROM schedule s
LEFT JOIN clinic c on c.clinic_id = s.clinic_id
LEFT JOIN doctor_has_specialization dhs on dhs.doctor_id = dhs.doctor_id
LEFT JOIN specialization ss on ss.specialization_id = dhs.specialization_id
LEFT JOIN doctor d on d.doctor_id = dhs.doctor_id";
$rs1 = mysql_query($sql1,$con);
**$row1 = mysql_fetch_row($rs1);**
$total = $row1[0];
$tp = ceil($total/10);
for($i = 1; $i <= $tp; $i++)
{
echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
}
?>
</body>
</html>