Log in

View Full Version : Include css+php in other page



auriaks
01-23-2010, 04:12 PM
I have this table in table1.php

<div class="sidebox">
<div class="boxhead">Prisijunge vartotojai</div>
<div class="boxbody">
<?php
include('db_conn.php');
$queryget = mysql_query("SELECT * FROM reg_users ORDER BY `date` DESC LIMIT 4") or die("Error with query");
while ($row = mysql_fetch_array($queryget))
{
$nick = $row['nick'];
$time = $row['time'];
$date = $row['date'];
$datet = date("Y-m-d");
$timet = date("H:i:s");
$id = $row['id'];

$time_seconds = 0;
$seconds = explode(':', $time);
$time_seconds += $seconds[0] * (60 * 60);
$time_seconds += $seconds[1] * 60;
$time_seconds += $seconds[2];

$timet_seconds = 0;
$seconds1 = explode(':', $timet);
$timet_seconds += $seconds1[0] * (60 * 60);
$timet_seconds += $seconds1[1] * 60;
$timet_seconds += $seconds1[2];

if ((($time_seconds-$timet_seconds) <= 300) AND ($date == $datet) AND (($time_seconds-$timet_seconds) >= 0)) {
$var = '1';
$when = 'Naršo';
echo "
<table width='200px';>
<tr>
<td width='100'>
<font size='0.8' face='Verdana' color='blue'><b>
<img src='images/online.png' width='13px' height='13px' border='0'><a style='text-decoration:none' href='user.php?id=$id'><font size='0px' face='Verdana' color='green'><b>$nick</a></b></font>
</b></font>
</td>
<td width='40'>
<font size='0.8' face='Verdana' color='green'><b>$when </b></font>
</td>
</tr>
</table>
";
} else {
$when = $date;
echo "
<table width='204px';>
<tr>
<td width='174'>
<font size='0.8' face='Verdana' color='blue'><b>
<img src='images/x.png' width='13px' height='13px' border='0'>&nbsp;<a style='text-decoration:none' href='user.php?id=$id'><font size='0px' face='Verdana' color='black'><b>$nick</a></b></font>
</b></font>
</td>
<td width='28'>
<font size='0.8' face='Verdana' color='black'><b>$when</b></font>
</td>
</tr>
</table>
";}}
?>
</div>
<div class="boxfooter">
</div>
</div>

How I can INCLUDE it to my index.php page?
thanks. :)

maybe it is possible to include only this part?

<?php
include('db_conn.php');
$queryget = mysql_query("SELECT * FROM reg_users ORDER BY `date` DESC LIMIT 4") or die("Error with query");
while ($row = mysql_fetch_array($queryget))
{
$nick = $row['nick'];
$time = $row['time'];
$date = $row['date'];
$datet = date("Y-m-d");
$timet = date("H:i:s");
$id = $row['id'];

$time_seconds = 0;
$seconds = explode(':', $time);
$time_seconds += $seconds[0] * (60 * 60);
$time_seconds += $seconds[1] * 60;
$time_seconds += $seconds[2];

$timet_seconds = 0;
$seconds1 = explode(':', $timet);
$timet_seconds += $seconds1[0] * (60 * 60);
$timet_seconds += $seconds1[1] * 60;
$timet_seconds += $seconds1[2];

if ((($time_seconds-$timet_seconds) <= 300) AND ($date == $datet) AND (($time_seconds-$timet_seconds) >= 0)) {
$var = '1';
$when = 'Naršo';
echo "
<table width='200px';>
<tr>
<td width='100'>
<font size='0.8' face='Verdana' color='blue'><b>
<img src='images/online.png' width='13px' height='13px' border='0'><a style='text-decoration:none' href='user.php?id=$id'><font size='0px' face='Verdana' color='green'><b>$nick</a></b></font>
</b></font>
</td>
<td width='40'>
<font size='0.8' face='Verdana' color='green'><b>$when </b></font>
</td>
</tr>
</table>
";
} else {
$when = $date;
echo "
<table width='204px';>
<tr>
<td width='174'>
<font size='0.8' face='Verdana' color='blue'><b>
<img src='images/x.png' width='13px' height='13px' border='0'>&nbsp;<a style='text-decoration:none' href='user.php?id=$id'><font size='0px' face='Verdana' color='black'><b>$nick</a></b></font>
</b></font>
</td>
<td width='28'>
<font size='0.8' face='Verdana' color='black'><b>$when</b></font>
</td>
</tr>
</table>
";}}
?>