Jump to content

DateRange to Post


hkalan2007

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.