3 Replies - 660 Views - Last Post: 04 January 2012 - 06:38 AM Rate Topic: -----

#1 decongh  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 39
  • Joined: 31-December 11

I created a filter script,but its not working,any help

Posted 04 January 2012 - 06:06 AM

    <?php
     
    $date = "";
    $driver = "";
    $vreg = "";
    $desti = "";
     
    $radiotype = $_REQUEST['find'];
     
    if ($radiotype == "")
    {
    echo"<p class='bodytxt'>N.B: You can filter by selecting any of the category of movement log you want to view.</p><br><br>
    ";
    exit();
    }
    if($radiotype == "driver")
    {
     
    $date_out = "";
    $date_in = "";
    $date_out = $_REQUEST['date_out'];
    $date_in = $_REQUEST['date_in'];
     
    list($d, $m, $y) = split('[/.-]', $date_out);
    list($ed, $em, $ey) = split('[/.-]', $date_in);
    $date_out = $y."-".$m."-".$d;
    $date_in = $ey."-".$em."-".$ed;
     
    $query = "SELECT * FROM movlog WHERE driver='$driver' BETWEEN ('$date_out') AND ('$date_in')";
     
     
    $pager = new PS_Pagination($conn,$query,10,10);
    $accra = $pager->paginate();
    while($row = mysql_fetch_assoc($accra))
     
    $id = $row['id'];
    $mileage_out = $row['mileage_out'];
    $mileage_in = $row['mileage_in'];
    $vreg = $row['vreg'];
    $ftype = $row['ftype'];
    $famount = $row['famount'];
    $driver = $row['driver'];
    $vtype = $row['vtype'];
    $dept = $row['dept'];
    $date_out = $row['date_out'];
    $date_in = $row['date_in'];
    $time_out = $row['time_out'];
    $time_in = $row['time_in'];
    $tt_con = $row['tt_con'];
    $tf_con = $row['tf_con'];
    }
     
    echo
    "
     
    <table width='100%' align='center' border='0' cellspacing='1' cellpadding='1'>
    <tr>
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$date_out</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$date_in</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$famount</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$vreg</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'><font color='#ffffff'>$driver</font></td>
     
    <td width='12.5' align='center' valign='middle' bgcolor='#009933' class='bodytxt'>
    <a href='verxbh738hmovx3z.php?nav=view&id=$id&zy9stxyw...' target='_blank'><img src='icon/view.gif' border='0'></a></td>
    </tr>
    </table>
    ";
    ?>


Is This A Good Question/Topic? 0
  • +

Replies To: I created a filter script,but its not working,any help

#2 cefram  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 19
  • Joined: 02-January 12

Re: I created a filter script,but its not working,any help

Posted 04 January 2012 - 06:18 AM

I think you missed out the opening curly brace on your while loop at line number 34 on the code that you provided.

Your code:
while($row = mysql_fetch_assoc($accra))
 
$id = $row['id'];
$mileage_out = $row['mileage_out'];
$mileage_in = $row['mileage_in'];
$vreg = $row['vreg'];
$ftype = $row['ftype'];
$famount = $row['famount'];
$driver = $row['driver'];
$vtype = $row['vtype'];
$dept = $row['dept'];
$date_out = $row['date_out'];
$date_in = $row['date_in'];
$time_out = $row['time_out'];
$time_in = $row['time_in'];
$tt_con = $row['tt_con'];
$tf_con = $row['tf_con'];
}



Notice the while statement? There's no curly brace. Add it up, and if it still does throw up an error, please do paste the error here, maybe we can help :)
Was This Post Helpful? 0
  • +
  • -

#3 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3520
  • View blog
  • Posts: 10,159
  • Joined: 08-June 10

Re: I created a filter script,but its not working,any help

Posted 04 January 2012 - 06:22 AM

without further looking Id say your query fails. the syntax of MySQL between is: expr BETWEEN min AND max (ref.) (youre missing the expr part)
Was This Post Helpful? 1
  • +
  • -

#4 Atli  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3717
  • View blog
  • Posts: 5,979
  • Joined: 08-June 10

Re: I created a filter script,but its not working,any help

Posted 04 January 2012 - 06:38 AM

Do no double post your questions! Use your original thread if you want to continue discussing this topic.

** Thread closed **
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1