Daterange to POST report

Hello,

I am going insane here…

I am trying to get a PHP file to grab the selected daterage data for mysql table to show on the webpage.

Firstly, the PHP is called to post by clicking a button after 2 dates are selected in a “Start” and “End” Jquery datepickers.

[code][/code]

The datepickers are in the BODY and seem to work fine so that the PHP file can see the dates.

1- The report.php file gets the dates and change the date to the mysql format of yyyy-mm-dd.
2- then it connects to the mysql database with login, password.
3-Then the sql script should select the collums I want, and get the rows beteen the "dates from the datepickers.
4-Then the PHP should make a table to display the data in a nice view in the DIV that the JQuery has in the post function…

[php]<?
$start = (isset($_POST[‘start1’])) ? date(“Y-m-d”,strtotime($_POST[‘start1’])) : date(“Y-m-d”);
$end = (isset($_POST[‘end1’])) ? date(“Y-m-d”,strtotime($_POST[‘end1’])) : date(“Y-m-d”);
$con = mysql_connect(‘localhost’, ‘root’, ‘xxxxxxxxxx’);
if (!$con)
{
die('Could not connect: ’ . mysql_error());
}
mysql_select_db(“inverters”, $con);

$sql = ‘SELECT date, time ,power FROM feed AS genreport BETWEEN $start AND $end’;
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res))
echo $row[‘genreport’];
echo "

";

while($row = mysql_fetch_array($result))
{
echo “

”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
echo “”;
}
echo “
Date Hour Power Volt Current
” . $row[‘Date’] . “” . $row[‘Time’] . “” . $row[‘Power’] . “” . $row[‘Volt’] . “” . $row[‘Current’] . “
”;

mysql_close($con);
?>[/php]

I do not understand why it does not work on the web page… What could be wrong ? Every time I click the button when in a browser says “error on page (in the bottom” of both IE and FF, and Safari.

The form on the web page shows the datepickers and the button very clearly, and should get the datetext to start with the "onClick action, thet the JQuery script shows…

<form name="calz">Start Date: <input id="start1" type="text" size="10"> End Date: <input id="end1" type="text" size="10"> <input type="button" value="Generate" onClick="get(start1, end1);"></form>

I just don’t get where I am going wrong !

Alan

To debug the problem, try to replace this line in your javascript:

$('#genreport').html(data).show();

to this:

alert(data);

This will show you generated HTML code, and you will see why there is javascript warnings.
And speaking on that line… I think the correct jquery code would be this:

$('#genreport').html(data);
Sponsor our Newsletter | Privacy Policy | Terms of Service