hkalan2007 Posted November 15, 2010 Share Posted November 15, 2010 Hello, I have 2 jquery date pickers (start and end date) to pull the daterange mysql data,that will POST data on the webpage from mysql table. I can not seem to get the PHP to work right. The table is very simple. Unit ID | DATE | Time | Power | Volt | Current| Data is entered every hour (24 hours a day) The jquery date pickers select the date range on the website to post the report.php, and I wish to display the Date,Time,Power,Volt,Current in that range in a straight table on the wen page. You can see the how I want it on the website http://www.pvmonitor.000a.biz/sw-report.php This will help you understand my meaning better. Here is the report.php... Please let me know where I am going wrong. <? $start = (isset($_POST['start'])) ? date("Y-m-d",strtotime($_POST['start'])) : date("Y-m-d"); $end = (isset($_POST['end'])) ? date("Y-m-d",strtotime($_POST['end'])) : date("Y-m-d"); $con = mysql_connect('localhost', 'root', 'XXXXXX'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("inverters", $con); $sql='select * FROM feed AS genreport ' .'BETWEEN [start] and [end]'; $res = mysql_query($sql); while ($row = mysql_fetch_assoc($res)) echo $row['genreport']; echo "<table border='1'> <tr> <th>Date</th> <th>Hour</th> <th>Power</th> <th>Volt</th> <th>Current</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['Date'] . "</td>"; echo "<td>" . $row['Time'] . "</td>"; echo "<td>" . $row['Power'] . "</td>"; echo "<td>" . $row['Volt'] . "</td>"; echo "<td>" . $row['Current'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Thanks, Alan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.