Jump to content

Each table datewise


rashmi_k28

Recommended Posts

I have a code and I have to display the each table separately depending on the date.

 

Suppose I have 3 dates,

 

The records of each date should be displayed in separate table. Please tell me how to do it.

 

$start_date       = $_REQUEST["date1"];
$end_date         = $_REQUEST["date2"];

$res_head="select distinct(date(timestamp) from `tablename` where date(timestamp) >='".$start_date."' date(timestamp) <= '".$end_date."' and status=0";
$res1=mysql_query($res_head);
while($res=mysql_fetch_array($res1)){

//Some code

array_push($records,"$result[2]#$ip[0]#$result[2]#$previoustime#$result[1]#$d");

 

 

<TABLE BORDER=2 CELLPADDING=4 width=\"100%\" bordercolor=\"#000000\"><TR><TH COLSPAN=2>DATE AS ON $start_date</TH><th COLSPAN=6>Status(Down)</th></TR><TR><TH COLSPAN=8> STATUS OF NETWORK</TH></TR><TR><TD>SL NO</TD><TD>CLIENT  NAME</TD><TD>IP ADDRESS</TD><TD> NAME</TD><TD>START TIME</TD><TD>END TIME</TD><TD>DURATION in (days:hours:minutes)</TD></TR>

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/97934-each-table-datewise/
Share on other sites

<?

$res_head="select distinct(date(timestamp) from `tablename` where date(timestamp) >='".$start_date."' date(timestamp) <= '".$end_date."' and status=0";
$res1=mysql_query($res_head);
$data="";
while($res=mysql_fetch_array($res1)){
    $data .='<table>';
    $res2="select from table where date='$res[0]'";
    while($res3=mysql_fetch_array($res2))
        {
            $data .='<tr>';
            $data .='<td>'.$res3[0].'</td>';
            $data .='<td>'.$res3[1].'</td>';
            $data .='</tr>';
            }
$data .='</table>';

}

?>

Link to comment
https://forums.phpfreaks.com/topic/97934-each-table-datewise/#findComment-501049
Share on other sites

plz go through the code

 

i am taking the distinct dates then

 

i will start a new loop to take the details of the date

 

each distinct date details will be shown in different table (HTML)

 

if this is not your requirement, try to describe in details  ??? >:(

Link to comment
https://forums.phpfreaks.com/topic/97934-each-table-datewise/#findComment-501062
Share on other sites

Hi,

 

Thanks for your reply.

 

 

I want the code where based on the date the output for a particular date should form a separate table

 

 

<table>

Date 1 information

</table>

<br>

 

<table>

Date 2 information

</table>

 

Like this for the number of date the table should be dispalyed

 

Link to comment
https://forums.phpfreaks.com/topic/97934-each-table-datewise/#findComment-501080
Share on other sites

thats what the above code will do  :o :o :o :o :o

 

<?

 

selecting the distinct dates

$res_head="select distinct(date(timestamp) from `tablename` where date(timestamp) >='".$start_date."' date(timestamp) <= '".$end_date."' and status=0";

$res1=mysql_query($res_head);

$data="";

while($res=mysql_fetch_array($res1)){

 

STARTING THE TABLE OPENING

    $data .='<table>';

 

GETTING THE INFORMATION OF THAT DATE FROM OTHER TABLE , YOU CAN SKIP THIS IF YOU WANT

 

    $res2="select from table where date='$res[0]'";

    while($res3=mysql_fetch_array($res2))

        {

            $data .='<tr>';

            $data .='<td>'.$res3[0].'</td>';

            $data .='<td>'.$res3[1].'</td>';

            $data .='</tr>';

            }

 

CLOSING THE TABLE AFTER EACH DATE

$data .='</table>';

 

 

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/97934-each-table-datewise/#findComment-501085
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.