我的PHP代码
<?php
include 'dbConnect.php'; // include your code to connect to DB.
// How many adjacent pages should be shown on each side?
$adjacents = 3;
/*
First get total number of rows in data table.
If you have a WHERE clause in your query, make sure you mirror it here.
*/
//$query = "SELECT COUNT(*) as num FROM $tbl_name";
echo $to11=trim($_GET['to']);
$query = "select count(SRfeedback.ackNo) as num from SRfeedback,tblRepairQueue where tblRepairQueue.ackNo=SRfeedback.ackNo and tblRepairQueue.ackNo like '".$locationprefix."%'
and DATE(tblRepairQueue.ClosedAt) >='".$from."' and DATE(tblRepairQueue.ClosedAt) <='2013-10-03'
and tblRepairQueue.repairStatus='Closed and Complete'" ;
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
/* Setup vars for query. */
$targetpage = "ipad_xl.php"; //your file name (the name of this file)
$limit = 10; //how many items to show per page
$page = $_GET['page'];
if($page)
$start = ($page - 1) * $limit; //first item to display on this page
else
$start = 0; //if no page var is given, set start to 0
/* Get data. */
$sql = "SELECT tblRepairQueue.ackNo as RAF ,tblRepairQueue.productDescription as PRODUCT , tblRepairQueue.customerName as CUSTOMER,tblRepairQueue.SR_id as ASSIGNED, SRfeedback.overall as OVERALL,SRfeedback.technical as TECHNICAL,SRfeedback.professionalism as PROFESSIONALISM,SRfeedback.response as RESPONSE,SRfeedback.quality as QUANTITY,SRfeedback.time as TIME FROM SRfeedback,tblRepairQueue where tblRepairQueue.ackNo=SRfeedback.ackNo and tblRepairQueue.ackNo like '".$locationprefix."%'
and date(tblRepairQueue.ClosedAt) between '$from' and '2013-09-01' and tblRepairQueue.repairStatus='Closed and Complete' LIMIT $start, $limit";
//$sql = "select tblRepairQueue.ackNo as RAF from SRfeedback,tblRepairQueue where tblRepairQueue.ackNo=SRfeedback.ackNo and tblRepairQueue.ackNo like '".$locationprefix."%' and DATE(tblRepairQueue.ClosedAt) between '".$from."' and '".$to."'
//and tblRepairQueue.repairStatus='Closed and Complete' LIMIT $start, $limit";
$result = mysql_query($sql);
/* Setup page vars for display. */
if ($page == 0) $page = 1; //if no page var is given, default to 1.
$prev = $page - 1; //previous page is page - 1
$next = $page + 1; //next page is page + 1
$lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up.
$lpm1 = $lastpage - 1; //last page minus 1
/*
Now we apply our rules and draw the pagination object.
We're actually saving the code to a variable in case we want to draw it more than once.
*/
$pagination = "";
if($lastpage > 1)
{
$pagination .= "<div class=\"pagination\">";
//previous button
if ($page > 1)
$pagination.= "<a href=\"$targetpage?page=$prev\">previous</a>";
else
$pagination.= "<span class=\"disabled\">previous</span>";
//pages
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
{
for ($counter = 1; $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
}
elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some
{
//close to beginning; only hide later pages
if($page < 1 + ($adjacents * 2))
{
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";
}
//in middle; hide some front and some back
elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
{
$pagination.= "<a href=\"$targetpage?page=1\">1</a>";
$pagination.= "<a href=\"$targetpage?page=2\">2</a>";
$pagination.= "...";
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
$pagination.= "...";
$pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
$pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";
}
//close to end; only hide early pages
else
{
$pagination.= "<a href=\"$targetpage?page=1\">1</a>";
$pagination.= "<a href=\"$targetpage?page=2\">2</a>";
$pagination.= "...";
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
{
if ($counter == $page)
$pagination.= "<span class=\"current\">$counter</span>";
else
$pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";
}
}
}
//next button
if ($page < $counter - 1)
$pagination.= "<a href=\"$targetpage?page=$next\">next</a>";
else
$pagination.= "<span class=\"disabled\">next</span>";
$pagination.= "</div>\n";
}
?>
<table bgcolor="#FFFFFF" width="100%" border="0" cellspacing="1" cellpadding="3" style="outline:1px solid #CCC">
<tr style="background: url(../images/nav.png); color:#FFF; font-weight:600">
<td>overall</td>
<td>technical</td>
<td>Customer Name</td>
<td>Assigned</td>
<td>Overall</td>
<td>Technical</td>
<td>Professionalism</td>
<td>Response</td>
<td>Quality</td>
<td>Time</td>
</tr>
<?php
while($row = mysql_fetch_array($result) )
{ ?>
<tr align="center" bgcolor="#E8F8FF" style="color:#006">
<td><?=$row['RAF']?></td>
<td><?=$row['PRODUCT']?></td>
<td><?=$row['CUSTOMER']?></td>
<td><?=$row['ASSIGNED']?></td>
<td><?=$row['OVERALL']?></td>
<td><?=$row['TECHNICAL']?></td>
<td><?=$row['PROFESSIONALISM']?></td>
<td><?=$row['RESPONSE']?></td>
<td><?=$row['QUANTITY']?></td>
<td><?=$row['TIME']?></td>
</tr>
<? }
?>
<tr><td colspan="3"><img src="../images/download.png" width="60" height="40" onClick="return download_file();"/></td>
<td align="center" colspan="9"><?=$pagination?> </td></tr>
</table>
<?
一切正常,但我的问题是
当我立即单击下载图像时不起作用但是在我进行任何分页并单击下载 img 后它的工作.. 任何人都可以解决这个问题