Dear all,
I have been thinking of this task, but I have no idea where to start from.
I am retrieving login logs from the database, which is cool.
Now, the challenge is that in case a user has logged in more than once in the same day, I want his records to be in the same row, probably create a rowspan for the other login information. I am thinking that the login log should look like this;
----------------------------------------------------------------------------
|DATE | USER | LOGIN RESULT | COMMENTS |
----------------------------------------------------------------------------
|2014:03:28 | Julius | Successful |Correct details |
----------------------------------------------------------------------------
| | Failed |Wrong Password |
----------------------------------------------------------------------------
| |Successful |Correct details |
----------------------------------------------------------------------------
The code I know of only gets them in a new row. This is the code am using;
<?php
include('includes/connect.php');
// select record from mysql
$sql="SELECT * FROM login_logs";
$result=mysql_query($sql);
if(mysql_num_rows($result) == 0){ echo "<font color='red' size='3'>No Registered records yet</font>";
}
else
{
echo "<table width='700' border='0'>
<tr style='font-size: 12px; font-weight: bold; color: rgb(0, 153, 204); background: none repeat scroll 0% 0% rgb(230, 249, 217);'>
<td width='150'>Login date</td>
<td width='150'>User</td>
<td width='100'>Login result</td>
<td width='200'>Notes</td>
</tr>";
?>
<?php
$num=1;
while($rows=mysql_fetch_array($result)){
$num++;
$skizzy = $rows['school_id'];
if(($num%2)!=0){
$bg="#FFFF99";
}else{
$bg="#FFFFFF";
}
?>
<tr bgcolor="<?php echo $bg; ?>">
<td><?php echo $rows['login_date']." [GMT+3]"; ?></td>
<td><?php echo $rows['username']; ?></td>
<td><?php echo $rows['login_result']; ?></td>
<td><?php echo $rows['login_notes']; ?></td>
</tr>
<?php
}
}
?>
</table>
If anybody can point me to the right direction ....
Thank you.