I have a simple script here just to extract the record from mysql from the 2 date range. It is weird it just show 4 records while there is 6 records, I did not set any limit to the records. Can anyone help me out?
Try selecting from:- 1st February till 27th February
Here is my testing site: http://iamawesome.xyz/track/review.php
Here is my code:-
$done = 0;
function displayTable($results) {
$total_result = count($results);
echo $total_result." results found.";
for($x = 1; $x <= $total_result; $x++) {
//echo "<tr><td>$allresult['id'][$x]</td>";
echo "<tr><td>".$results['date'][$x]."</td>";
echo "<td>".$results['url'][$x]."</td>";
echo "<td>".$results['clickid'][$x]."</td>";
echo "<td>".$results['code'][$x]."</td></tr>";
}
}
if (isset($_POST['sub'])) {
$datefrom = $_POST['fromdatetime'];
$dateto = $_POST['todatetime'];
if ($datefrom == "From" || $datefrom == "" && $dateto == "To" || $dateto == "") {
echo "ERROR! No date/time selected";
}
else {
/* create a prepared statement */
$stmt = mysqli_prepare($mysqli, "SELECT * FROM data WHERE date_data between (?) AND (?)");
/* bind parameters for markers */
mysqli_stmt_bind_param($stmt, "ss", $datefrom, $dateto);
/* execute query */
mysqli_stmt_execute($stmt);
/* bind result variables */
mysqli_stmt_bind_result($stmt, $resultid, $resulturl, $resultdate, $resultclickid, $resultcode);
$resultcount = 0;
$allresult = array();
/* fetch value */
while (mysqli_stmt_fetch($stmt)) {
//$allresult['id'][$resultcount] = $resultid;
$allresult['url'][$resultcount] = $resulturl;
$allresult['date'][$resultcount] = $resultdate;
$allresult['clickid'][$resultcount] = $resultclickid;
$allresult['code'][$resultcount] = $resultcode;
$resultcount++;
}
/* close statement */
mysqli_stmt_close($stmt);
/* close connection */
mysqli_close($mysqli);
$done = 1;
}
}
?>
<style>
.searchbox {
border-radius: 20px; 20px; 20px; 20px;
-moz-border-radius: 20px; 20px; 20px; 20px;
-webkit-border-radius: 20px; 20px; 20px; 20px;
border: 2px solid #58ACFA;
}
</style>
<div class="searchbox">
<form action="review.php" method="post" style="margin-left:20px; padding-top:10px;">
<input id="fromdatetime" name="fromdatetime" type="text" placeholder="From" readonly> - <input id="todatetime" name="todatetime" type="text" placeholder="To" readonly>
<input type="submit" name="sub" value="Search" id="btnreview">
</form>
</div>
<br><br>
<?php
if ($done == 1) {
?>
<div class="searchbox">
<table border="1" width="100%" cellspacing="100%">
<tr>
<td><b>Date/Time</b></td>
<td><b>From URL</b></td>
<td><b>ClickID</b></td>
<td><b>Affiliate Code</b></td>
</tr>
<?php
displayTable($allresult);
}
?>
</table>