NEVER YOU MIND, I ALREADY SOLVED IT. I JUST USED DATE_FORMAT ... AS ... and, problem solved.
I have this code. I have a field that gives me the time and the hour automatically (TIMESTAMP), and everything works perfectly, except that in the 'results' not the divider... I need to, also; display the hour, which, you must know, if I add the '%r' for some reason it will separate my tables by 'Hour' and not by 'Month/year' as I want to.
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("starplastdb", $con);
$result = mysql_query("SELECT DATE_FORMAT(date, '%d/%m/%Y') date, name, destinatary FROM received ORDER BY date DESC");
$currentDate = false;
while($row = mysql_fetch_array($result))
{
if ($row['date'] != $currentDate){
echo
"<table id='llamadas'><tr><td colspan='4'>" .
$row['date'] .
"</tr></td>" ;
$currentDate = $row['date'];
echo "<tr>
<th>Fecha</th>
<th>Persona que llama</th>
<th>Destinatario</th>
</tr> <tr>";
}
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['destinatary'] . "</td>";
echo "</tr>";
}
mysql_close($con);
?>
What I want to do, is maybe make another query so I can do that or I don't know what solution can you provide, so i can show this:
"<table id='llamadas'><tr><td colspan='4'>" .
$row['date'] .
"</tr></td>" ;
in this format:
DATE_FORMAT(date, '%d/%m/%Y')
and here:
echo "<td>" . $row['date'] . "</td>";
in this format:
DATE_FORMAT(date, '%d/%m/%Y %r')
Is there a way to do that, be it by PHP or just making two queries in MYSQL directly? I know people says it's very bad to do that, but it's for a very simple app, as you can infer.
Thank you a lot! I'm super stuck!