hi everyone i have this code(dont think its a code spam ..its a trick)
which display the date(only):
<a href="index.php" STYLE="TEXT-DECORATION: NONE">«Back•</a>
<br>
<br>
<hr width="200" align="left">
<br>
<?php
$conn=odbc_connect('datasourcegaby','','');
$search=mysql_escape_string($_POST['SEARCH']);
if (!$conn)
{exit("Connection Failed: " . $conn);}
if($search==null){
header("location:index.php");
}else{
$sql="SELECT * from generators WHERE convert(datetime,convert(char(10),TIMESTOMPX,101))= '$search'";
};
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<div class=\"resultx\"><font size=\"4\">Result for:</font> <font color=\"red\"> $search </font></div><br><hr width=\"200\" align=\"left\"><br><div class=\"rightdv\"><div class=\"topg\"><FONT SIZE=\"5\" color=\"#FFFFFF\">•• TOTAL ••</FONT></div><table border=\"1\" style=\"table-layout:fixed\" class=\"totalinsidet\"><tr class=\"topbth\">";
echo "<th>TOTALMW</th>";
echo "<th>TOTALMVAR</th></tr>";
while (odbc_fetch_row($rs))
{
$genmw=odbc_result($rs,"TOTALMW");
$genvar=odbc_result($rs,"TOTALMVAR");
echo "<tr>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$genmw</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$genvar</td></tr>";
}
echo "</table></div>";
?>
<?php
$conn=odbc_connect('datasourcegaby','','');
$search=mysql_escape_string($_POST['SEARCH']);
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT GEN1MW,GEN1PF,GEN1MVAR FROM generators WHERE convert(datetime,convert(char(10),TIMESTOMPX,101)) = '$search'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<div class=\"leftdv\"><div class=\"topb\"><FONT SIZE=\"5\">GENERATOR 1</FONT></div><table border=\"1\" style=\"table-layout:fixed\" class=\"totalinsidet\"><tr class=\"topbth\">";
echo "<th>GEN1MW</th>";
echo "<th>GEN1PF</th>";
echo "<th>GEN1MVAR</th></tr>";
while (odbc_fetch_row($rs))
{
$gen1mw=odbc_result($rs,"GEN1MW");
$gen1pf=odbc_result($rs,"GEN1PF");
$gen1mvar=odbc_result($rs,"GEN1MVAR");
echo "<tr><td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen1mw</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen1pf</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen1mvar</td></tr></div>";
}
echo "</table>";
?>
<br>
<br>
<?php
$conn=odbc_connect('datasourcegaby','','');
$search=mysql_escape_string($_POST['SEARCH']);
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT GEN2MW,GEN2PF,GEN2MVAR FROM generators WHERE convert(datetime,convert(char(10),TIMESTOMPX,101)) = '$search'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<div class=\"topc\"><FONT SIZE=\"5\">GENERATOR 2</FONT></div><table border=\"1\" style=\"table-layout:fixed\" class=\"totalinsidet\"><tr class=\"topbth\">";
echo "<th>GEN2MW</th>";
echo "<th>GEN2PF</th>";
echo "<th>GEN2MVAR</th></tr>";
while (odbc_fetch_row($rs))
{
$gen2mw=odbc_result($rs,"GEN2MW");
$gen2pf=odbc_result($rs,"GEN2PF");
$gen2mvar=odbc_result($rs,"GEN2MVAR");
echo "<tr><td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen2mw</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen2pf</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen2mvar</td></tr>";
}
echo "</table>";
?>
<br>
<br>
<?php
$conn=odbc_connect('datasourcegaby','','');
$search=mysql_escape_string($_POST['SEARCH']);
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT GEN3MW,GEN3PF,GEN3MVAR FROM generators WHERE convert(datetime,convert(char(10),TIMESTOMPX,101)) = '$search'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<div class=\"topd\"><FONT SIZE=\"5\">GENERATOR 3</FONT></div><table border=\"1\" style=\"table-layout:fixed\" class=\"totalinsidet\"><tr class=\"topbth\">";
echo "<th>GEN3MW</th>";
echo "<th>GEN3PF</th>";
echo "<th>GEN3MVAR</th></tr>";
while (odbc_fetch_row($rs))
{
$gen3mw=odbc_result($rs,"GEN3MW");
$gen3pf=odbc_result($rs,"GEN3PF");
$gen3mvar=odbc_result($rs,"GEN3MVAR");
echo "<tr><td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen3mw</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen3pf</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen3mvar</td></tr>";
}
echo "</table>";
?>
<br>
<br>
<?php
$conn=odbc_connect('datasourcegaby','','');
$search=mysql_escape_string($_POST['SEARCH']);
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT GEN4MW,GEN4PF,GEN4MVAR FROM generators WHERE convert(datetime,convert(char(10),TIMESTOMPX,101)) = '$search'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<div class=\"tope\"><FONT SIZE=\"5\">GENERATOR 4</FONT></div><table border=\"1\" style=\"table-layout:fixed\" class=\"totalinsidet\"><tr class=\"topbth\">";
echo "<th>GEN4MW</th>";
echo "<th>GEN4PF</th>";
echo "<th>GEN4MVAR</th></tr>";
while (odbc_fetch_row($rs))
{
$gen4mw=odbc_result($rs,"GEN4MW");
$gen4pf=odbc_result($rs,"GEN4PF");
$gen4mvar=odbc_result($rs,"GEN4MVAR");
echo "<tr><td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen4mw</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen4pf</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen4mvar</td></tr>";
}
echo "</table>";
?>
<br>
<br>
<?php
$conn=odbc_connect('datasourcegaby','','');
$search=mysql_escape_string($_POST['SEARCH']);
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT GEN5MW,GEN5PF,GEN5MVAR FROM generators WHERE convert(datetime,convert(char(10),TIMESTOMPX,101))= '$search'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
echo "<div class=\"topf\"><FONT SIZE=\"5\">GENERATOR 5</FONT></div><table border=\"1\" style=\"table-layout:fixed\" class=\"totalinsidet\"><tr class=\"topbth\">";
echo "<th>GEN5MW</th>";
echo "<th>GEN5PF</th>";
echo "<th>GEN5MVAR</th></tr>";
while (odbc_fetch_row($rs))
{
$gen5mw=odbc_result($rs,"GEN5MW");
$gen5pf=odbc_result($rs,"GEN5PF");
$gen5mvar=odbc_result($rs,"GEN5MVAR");
echo "<tr><td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen5mw</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen5pf</td>";
echo "<td style=\"white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word\">$gen5mvar</td></tr></div>";
}
echo "</table>";
?>
<br>
<br>
<br>
<h4><a href="index.php" STYLE="TEXT-DECORATION: NONE">«Back</a></h4>
and i like to DISPLAY THE LAST DATA THAT HAS BEEN ENTERED IN THE DATABASE(MSSQL) in a specific date:
example: let say i want to display the last data entered in the database of september 1 ... like that how can i do that with my code? ..