In my PHP code is below.
<table width="100%" >
<tr width="100%" class="bgcolor_02">
<th ROWSPAN="2" >SUBJECTS </th>
<th COLSPAN="2" >EXAMS </th>
<th COLSPAN="2" >PROJECTS </th>
</tr>
<tr class="bgcolor_02">
<th id="1E"> 1.EXAM</th>
<th id="2E"> 2.EXAM</th>
<th id="1P"> 1.PROJECT</th>
<th id="2P"> 2.PROJECT</th>
</tr>
<?php
$myexamresults = $db-> getrows (" SELECT * FROM `es_exam_result` WHERE `es_studentid` = '".$_SESSION['eschools']['user_id']."' ORDER BY `es_examorder` ASC ");
$pre_subjects=subjectnameByClass($es_subjectshortname);
foreach ($pre_subjects as $ndsdersliste ) {
$subjeid=$ndsdersliste['es_subjectid']; ?>
<tr > <td ><?php echo $ndsdersliste['es_subjectname']; ?></td>
<?php
foreach ($myexamresults as $ndsmyexam) {
$puan="";
if( $ndsdersliste['es_subjectname'] == $ndsmyexam['es_subjectname'] ) {
$examname = $ndsmyexam['es_examname'];
$puan = $ndsmyexam['es_puan'];
if ($examname =="1.Exam"){ ?> <td headers="1E" ><?php {echo $puan ;} ?> </td> <?php }
if ($examname =="2.Exam"){ ?> <td headers="2E" ><?php {echo $puan ;} ?> </td> <?php }
if ($examname =="1.Project"){ ?> <td headers="1P" ><?php {echo $puan ;} ?> </td> <?php }
if ($examname =="2.Project"){ ?> <td headers="2P" ><?php {echo $puan ;} ?> </td> <?php }
} } ?>
</tr>
<?php } ?>
</table>
I can get exam results from database. But I can not insert correct data under headers. If a student have just "1.Project" result, It is showing under "1.Exam". How to insert under correct title. Thanks..
You have to create empty <td> if there is no result to have the same number of <td> for each <tr>:
<tr > <td ><?php echo $ndsdersliste['es_subjectname']; ?></td>
<?php
$td = [];
foreach ($myexamresults as $ndsmyexam) {
$puan="";
if( $ndsdersliste['es_subjectname'] == $ndsmyexam['es_subjectname'] )
{
$examname = $ndsmyexam['es_examname'];
$puan = $ndsmyexam['es_puan'];
if ($examname =="1.Exam") { $td['1E'] = $puan ; }
if ($examname =="2.Exam") { $td['2E'] = $puan ; }
if ($examname =="1.Project") { $td['1P'] = $puan ; }
if ($examname =="2.Project") { $td['2P'] = $puan ; }
}
}
if (isset($td['1E'])) echo '<td headers="1E">'.$td['1E'] .'</td>' ; else echo '<td headers="1E"></td>' ;
if (isset($td['2E'])) echo '<td headers="2E">'.$td['2E'] .'</td>' ; else echo '<td headers="2E"></td>' ;
if (isset($td['1P'])) echo '<td headers="1P">'.$td['1P'] .'</td>' ; else echo '<td headers="1P"></td>' ;
if (isset($td['2P'])) echo '<td headers="2P">'.$td['2P'] .'</td>' ; else echo '<td headers="2P"></td>' ;
?>
</tr>
Related
I need to solve this simple thing:
Got this code:
<?php
$xml=simplexml_load_file("d2ladder.xml") or die("Error: Cannot create object");
?>
<table width="100%" border="1" cellspacing="0" cellpadding="2" align="center" style="text-align:center">
<tbody>
<tr class="<?php if ($xml->ladder[12]->char[0]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
<td width="10%">1.</td>
<td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[0]->prefix; ?> <?php echo $xml->ladder[12]->char[0]->name; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[0]->class; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[0]->level; ?></td>
<td width="20%"><?php echo $xml->ladder[12]->char[0]->experience; ?></td>
</tr>
<tr class="<?php if ($xml->ladder[12]->char[1]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
<td width="10%">2.</td>
<td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[1]->prefix; ?> <?php echo $xml->ladder[12]->char[1]->name; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[1]->class; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[1]->level; ?></td>
<td width="20%"><?php echo $xml->ladder[12]->char[1]->experience; ?></td>
</tr>
</tbody>
</table>
Need to create rows on this table till char[99]
Maybe I need to use while? Because sometimes it wont get to 99 on the sitemap
Use for/while cycle:
for ($i = 0; $i < 100; $i++) {
?>
<tr class="<?php if ($xml->ladder[12]->char[$i]->status == "alive") { echo "alive"; } else { echo "dead"; } ?>">
<td width="10%"><?php echo $i; ?>.</td>
<td width="50%" style="text-align:left"><?php echo $xml->ladder[12]->char[$i]->prefix; ?> <?php echo $xml->ladder[12]->char[$i]->name; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[$i]->class; ?></td>
<td width="10%"><?php echo $xml->ladder[12]->char[$i]->level; ?></td>
<td width="20%"><?php echo $xml->ladder[12]->char[$i]->experience; ?></td>
</tr>
<?php }
See for cycle
Hope this helps.
Hello this is the code in my php, i dont get error but the items in the database doesn't show and only the else tag is execute.
<?php
$sql = $bdd->prepare('SELECT * FROM bgk9z_items');
if ($sql->fetchColumn() > 0) { //
while ($result = $sql->fetch(PDO::FETCH_ASSOC)){
?>
<tr>
<th id="checkbox"><input type="checkbox" name="toggle" /></th>
<td id="titre"><? echo $result['title']; ?>
<div class="opt"><span class="up">Modifier</span> <span class="del">Supprimer</span> <span class="sho">Afficher</span></div>
</td>
<td id="extrait"><? $string = $result['introtext']; $long = (strlen($string) > 13) ? substr($string,0,280).'...' : $string; echo $long;?></td>
<td id="cat"><? include_once(dirname(__DIR__) . '/controlers/show-cat-name.php'); ?></td>
<td id="etat"><? $rep = $result['published']; if ($rep == 1) { echo "Oui";} else{echo "Non";} ?></td>
<td id="image"><? echo "Image"; ?></td>
<td id="ident"><? echo $result['id']; ?></td>
</tr>
<?
}
}
else { ?>
<tr><td colspan="7" style="text-align: center; color: rgb(192, 0, 0); font-size: 23px; font-weight: bold;">NO ITEM TO SHOW</td></tr>
<?php }
?
I had Created a Web App in PHP Code igniter which generates table containing calculation of employees earning, deduction.
Since I am newbie to CI. I am trying to save the dynamic generated table data to database, but failed.
I am not getting that how to POST table data to Controller.
Any help is welcome.
This is My Controller To generate dynamic table
function index()
{
if($this->input->post("submit"))
{
$vals=$this->cpanel_model->esic();
if($vals){
$data['w_share']=$vals->w_share;
$data['e_share']=$vals->e_share;
}
$data["wshare"]="";
//echo $data['w_share'];
$city=$_POST["city"];
$v1= $data['w_share'];
$v2= '100';
$v3= $data['e_share'];
$arr=$_POST["wid"];
$arr1=$_POST["days"];
$arr2=$_POST["payment"];
$arr3=$_POST["wdays"];
for ($i=0; $i <count($arr1) ; $i++)
{
$net[$i]=($arr2[$i]/$arr3[$i])*$arr1[$i];
$wshare[$i]=($net[$i]/$v2)*$v1;
$eshare[$i]=($net[$i]/$v2)*$v3;
$total[$i]=$eshare[$i]+$wshare[$i];
$wdays[$i]=$arr3;
$days[$i]=$arr1;
}
$data["net"]=$net;
$data["wshare"]=$wshare;
$data["total"]=$total;
$data["eshare"]=$eshare;
$data["wdays"]=$arr3;
$data["days"]=$arr1;
$data["list"]=$this->payment_model->search($city);
$this->load->view("secure/php-version/esic",$data);
}
This Is My View to echo table values
<?php echo form_open('esic/insert',array("role"=>"form")); ?>
<div class="table-responsive">
<table border="1" id="t01" class="table table-striped table-bordered table-hover table-condensed">
<tr>
<th>Worker_id</th>
<th>Worker Name</th>
<th>Worker City</th>
<th>Designation</th>
<th>Working Days</th>
<th>Basic Payment</th>
<th>Net Payment</th>
<th>Present Days</th>
<th>Worker Share (1.75%)</th>
<th>Employee Share (4.75%)</th>
<th>Total</th>
</tr>
<?php $i=0; $sum2=0; ?>
<?php if(count($list)>0) { foreach ($list as $std) {?>
<tr>
<?php echo form_hidden("wid[]",$std["wid"]); ?>
<?php echo form_hidden("wdays[]",$wdays); ?>
<?php echo form_hidden("payment[]",$std["payment"]); ?>
<td><?php echo $std["wid"]; ?></td>
<td><?php echo $std["wname"]; ?></td>
<td><?php echo $std["city"]; ?></td>
<td><?php echo $std["designation"]; ?></td>
<td><?php echo $wdays[$i]; ?></td>
<td><?php echo $std["payment"]; ?></td>
<td><?php echo $net[$i]; ?></td>
<td><?php echo $days[$i]; ?></td>
<td><?php echo $wshare[$i]; ?></td>
<td><?php echo $eshare[$i]; ?></td>
<td><?php echo $total[$i]; ?></td>
<?php $sum2 += $std["payment"]; ?>
</tr>
<?php $i++;}}?>
<tr>
<?php
$sum=0;
$sum1=0;
$sum3=0;
$sum4=0;
$sum5=0;
$i=0;
foreach ($total as $value) {
$sum = $sum + $value;
$i++;
}
foreach ($days as $value) {
$sum1 = $sum1 + $value;
$i++;
}
foreach ($eshare as $value) {
$sum3 = $sum3 + $value;
$i++;
}
foreach ($wshare as $value) {
$sum4 = $sum4 + $value;
$i++;
}
foreach ($net as $value) {
$sum5 = $sum5 + $value;
$i++;
}
?>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td style="font-weight:bold; font-size:10pt;">
<?php echo $sum2; ?>
</td>
<td style="font-weight:bold; font-size:10pt;">
<?php echo $sum5; ?>
</td>
<td style="font-weight:bold; font-size:10pt;">
<?php echo $sum1; ?>
</td>
<td style="font-weight:bold; font-size:10pt;">
<?php echo $sum4; ?>
</td>
<td style="font-weight:bold; font-size:10pt;">
<?php echo $sum3; ?>
</td>
<td style="font-weight:bold; font-size:10pt;">
<?php echo $sum; ?>
</td>
</tr>
</table>
</div>
<?php echo form_submit(array("name"=>"submit","type"=>"submit","value"=>"Create ESIC")); ?>
<?php echo form_close(); ?>
Its not too clear on how you are currently generating your table, but regardless, when you generate your table you have to place it in a form, and assign keys to inputs. Try this approach:
HTML (these are the results you should get when you generate your table)
<form action="<?= base_url() ?>table_data" method="post">
<table>
<thead>
<tr>
<th>Name</th>
<th>Earnings</th>
<th>Deduction</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="hidden" name="table[0][name]" value="name1">name1</td>
<td><input type="hidden" name="table[0][earning]" value="earning1">earning1</td>
<td><input type="hidden" name="table[0][deduc]" value="deduc1">deduc1</td>
</tr>
<tr>
<td><input type="hidden" name="table[1][name]" value="name1">name1</td>
<td><input type="hidden" name="table[1][earning]" value="earning1">earning1</td>
<td><input type="hidden" name="table[1][deduc]" value="deduc1">deduc1</td>
</tr>
</tbody>
</table>
<input type="submit" value="Submit this table">
</form>
Controller:
function table_data() {
if ($this->input->post()) {
$table_data = $this->input->post('table');
$this->load->model('model_name');
$this->model_name->insert_table_data($table_data);
}
}
Model:
function insert_table_data($table_data){
$this->db->insert_batch('mytable', $table_data);
}
I have a basic admin panel where I can see all the vendors and all the products that have been added. In the vendors page, I want to add a link which when clicked on would display/add/edit only the products for that vendor. Any leads on how this can be done?
************ EDIT **************
This is how my products page looks like. This page displays all the products.
<?php
$sno=$pagination->getLimit() + 1;
$sql2 = $sql1." limit " . $pagination->getLimit() . ", ". $rowsperpage;
$res2 = #mysql_query($sql2, $connection) or die("failed");
$i = 1;
$c=1;
$k=0;
while($res=mysql_fetch_array($res2))
{
?>
<tr <?php if($k==0) { echo 'class=""'; } else { echo 'class="row_color"'; } ?> id="row<?php echo $i;?>">
<td class="table_text"><?php echo $sno; ?>.</td>
<td class="table_text" style="line-height:12pt;">
<?php
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo $res['Name']; ?></span>
<?php
}
else
{
?>
<?php echo $res['Name']; ?>
<?php
}
?>
</td>
<td class="table_text" style="line-height:12pt;">
<?php
$rest_name = mysql_query("SELECT * FROM `restaurants` WHERE `RestID`='$res[RestID]'");
$res_fet = mysql_fetch_array($rest_name);
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo $res_fet['Name']; ?></span>
<?php
}
else
{
?>
<?php echo $res_fet['Name']; ?>
<?php
}
?>
</td>
<td class="table_text" style="line-height:12pt;"> <?php
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo date('d-m-Y',strtotime($res['StartDate']));?></span>
<?php
}
else
{
?>
<?php echo date('d-m-Y',strtotime($res['StartDate']));?>
<?php
}
?> </td>
<td class="table_text" style="line-height:12pt;"><?php
if($res['off_status']=='N')
{
?>
<span style="padding-left: 0px;font-weight:bold;color:#E8E8E8;"><?php echo date('d-m-Y',strtotime($res['ExpiryDate']));?></span>
<?php
}
else
{
?>
<?php echo date('d-m-Y',strtotime($res['ExpiryDate']));?>
<?php
}
?></td>
<td class="table_text"><table width="68" height="68" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffebc1">
<tr>
<td align="center"><?php
if($res['Image'] != "")
{
?>
<img src="../images/offers/thumb/<?php echo $res['Image']; ?>" border="0" />
<?php
}
else
{
?>
<img src="../images/no_image.jpg" width="88" height="76" border="0" />
<?php
}
?> </td>
</tr>
</table></td>
<td align="center" class="table_text"><img src="images/icon/level.png" width="47" height="43" border="0" /></td>
<td align="center" class="table_text"><img src="images/link.png" alt="" width="47" height="43" border="0" /></td>
<td align="center" class="table_text"><img src="images/icon/edit_icon.gif" width="16" height="15" border="0" /></td>
<td align="center" class="table_text"><img src="images/icon/view_icon.gif" width="16" height="16" border="0" /></td>
<?php
if($res['off_status']=='Y')
{
?>
<td align="center" class="table_text">Active</td>
<?php
}
else
{
?>
<td width="15%" align="center" class="table_text"> Inactive</td>
<?php
}
?>
<td width="14%" align="center" class="table_text"><img src="images/del.png" width="16" height="15" border="0" /></td>
</tr>
<?php
$c++;
$i++;
$k++;
$sno++;
if($k==2)
{
$k=0;
}
}
?>
<input type="hidden" name="acount" id="acount" value="<?php echo $i-1; ?>">
</table>
This is how I've called the link to the above mentioned page:
<?php
$sel=mysql_query("select * from offers where OfferID='".$id."'") or die(mysql_error());
$fet=mysql_fetch_array($sel);
$rest=mysql_query("select * from restaurants where RestID='".$fet['RestID']."'") or die(mysql_error());
$restfet=mysql_fetch_array($rest);
$dd= $fet['Links'];
$rest_id=$fet['RestID'];
$sql_mlink=mysql_query("select * from offers where off_status='Y' and OfferID!='".$id."' and RestID='".$rest_id."' order by OfferID asc") or die(mysql_error());
$sql_query = mysql_query("SELECT * FROM offers where RestID='".$res['RestID']."'");
$row = mysql_fetch_array($sql_query);
//$res_count=mysql_num_rows($row);
$sy = mysql_query("SELECT * FROM offers where RestID='".$res['RestID']."' and status='Y'");
$res_count=mysql_num_rows($sy);
$rw = mysql_fetch_array($sy);
?>
<td class="table_text">
Menu
</td>
You should be able to achieve this quite easily using php get and adjusting you're SQL slightly.
Add the vendor number/escaped name to the end of links to this page... e.g.:
<a href='this-page.php?vendor=vendor-1'>vendor 1</a>
Then at the beginning of the page check if there was a vendor set and if so, create some extra sql for the end of your statements. If not leave the extra sql variable blank so nothing is added:
if(!empty($_GET['vendor']))
{
$extra_sql = " AND vendor = ".$_GET['vendor'];
}
else
{
$extra_sql = "";
}
Then add the $extra_sql variable to the end of your existing SQL:
$rest=mysql_query("select * from restaurants where RestID='".$fet['RestID']."'".$extra_sql) or die(mysql_error());
is this a good way of doing it? or should i use a date time stamp with seconds rather?
while i am on a page, the new message must come through without me refreshing the page
my code is written in php:
<div id='div_longgray_gradient2'>
<div id='div_float_img'>
<table width='96%' border='0'>
<tr>
<td rowspan='2' width='40px' align='left'>
<img src='/images/rainbow/arrow.png'>
</td>
<td align='left'>
<span class='spn_big_black_rbc'>MESSAGES</span>
</td>
</tr>
<tr>
<td align='left'>
<span class='spn_med_lightblue_rbc'>Inbox</span>
</td>
<td align='left'>
</td>
</tr>
</table>
<br/>
<br/>
<table width='80%' align='center'>
<tr>
<td class='td_show_contact_heading' align='left'><span class='spn_med_lightblue_rbc'>Received</span></td>
<td class='td_show_contact_heading' align='left'><span class='spn_med_lightblue_rbc'>Message</span></td>
<td class='td_show_contact_heading' align='left'><span class='spn_med_lightblue_rbc'>From</span></td>
</tr>
<?php
$cursor = $pager->getFirstIndice();
foreach ($pager->getResults() as $msg)
{
$has_freechat = false;
//changed id to withid here
$freechat_req_link="profiles/confirmfreechat?withid=".$msg->getRcProfileTableRelatedByProfileIdFrom()->getId();
$freechat_req_link=link_to('Freechat',$freechat_req_link,'class=link_small_dark');
$cc = sizeof ($fc_records);
for($i = 0; $i < $cc; $i++)
{
if($fc_records[$i]->getProfileIdWith() == $msg->getProfileIdFrom())
{
$has_freechat = true;
break;
}
}
$unique_code_from = $msg->getRcProfileTableRelatedByProfileIdFrom()->getUniqueCode();
$block_url = link_to('Block User',"blocklist/block?unqiue_code=$unique_code_from",'class=link_medium_blue');
echo "<tr>";
$date = add_date($msg->getCreatedAt(),$hr=2);
echo "<td class='td_show_contact_item' align='left'>".$date."</td>";
$opened_once = $msg->getOpenedOnce();
if($opened_once >= 1)
{
echo "<td class='td_show_contact_item' align='left'>".link_to($msg->getSubject(), 'messagebox/read?cursor='.$cursor,'class=link_medium_blue')."</td>";
}
else
{ ?>
<td align='left'>
<a href="<?php echo url_for('messagebox/read?cursor=').$cursor ?>" style='color:#ff0000 !important' class='spn_small_red_rbc'><?php echo $msg->getSubject();?></a>
</td>
<?php
}
echo "<td class='td_show_contact_item' align='left'>".$unique_code_from." ( $block_url )</td>";
echo "</tr>";
++$cursor;
}
function add_date($givendate,$hr=2)
{
$cd = strtotime($givendate);
$newdate = date('Y-m-d H:i:s', mktime(date('h',$cd)+$hr, date('i',$cd), date('s',$cd), date('m',$cd), date('d',$cd), date('Y',$cd)));
return $newdate;
}
?>
</table>
<br/>
Displaying results <?php echo $pager->getFirstIndice() ?> to <?php echo $pager->getLastIndice() ?>.
<br/>
<?php if ($pager->haveToPaginate()): ?>
<?php echo link_to('«', 'messagebox/list?page='.$pager->getFirstPage()) ?>
<?php echo link_to('<', 'messagebox/list?page='.$pager->getPreviousPage()) ?>
<?php $links = $pager->getLinks(); foreach ($links as $page): ?>
<?php echo ($page == $pager->getPage()) ? $page : link_to($page, 'messagebox/list?page='.$page) ?>
<?php if ($page != $pager->getCurrentMaxLink()): ?> - <?php endif ?>
<?php endforeach ?>
<?php echo link_to('>', 'messagebox/list?page='.$pager->getNextPage()) ?>
<?php echo link_to('»', 'messagebox/list?page='.$pager->getLastPage()) ?>
<?php endif ?>
<table width='96%' border='0'>
<tr>
<td rowspan='2' width='40px' align='left'>
<img src='/images/rainbow/arrow.png'>
</td>
<td align='left'>
<span class='spn_big_black_rbc'></span>
</td>
</tr>
<tr>
<td align='left'>
<span class='spn_med_lightblue_rbc'>Sent Items</span>
</td>
</tr>
</table>
<br/>
<br/>
<table width='80%' align='center'>
<tr>
<td class='td_show_contact_heading' align='left'><span class='spn_med_lightblue_rbc'>Sent</span></td>
<td class='td_show_contact_heading' align='left'><span class='spn_med_lightblue_rbc'>Message</span></td>
<td class='td_show_contact_heading' align='left'><span class='spn_med_lightblue_rbc'>To</span></td>
</tr>
<?php
$cursor2 = $pager2->getFirstIndice();
$br = sizeof ($block_records);
foreach ($pager2->getResults() as $item)
{
$link = link_to('Delete',"messagebox/deleteSentmsg?mid=".$item->getId(),'class=link_medium_blue');
$id = $item->getRcProfileTableRelatedByProfileIdTo()->getId();
?>
<tr>
<td class='td_show_contact_item' width='15%' align='left'><?php echo $date = add_date($item->getCreatedAt(),$hr=2); ?></td>
<td class='td_show_contact_item' width='45%' align='left'><?php echo $item->getMessage()?></td>
<td class='td_show_contact_item' width='25%' align='left'><?php echo $item->getRcProfileTableRelatedByProfileIdTo()->getUniqueCode()." ".$link;?></td>
</tr>
<?php
++$cursor2;
}
?>
</table>
<br/>
Displaying results <?php echo $pager2->getFirstIndice(); ?> to <?php echo $pager2->getLastIndice(); ?>.
<br/>
<?php if ($pager2->haveToPaginate()): ?>
<?php echo link_to('«', 'messagebox/list?page2='.$pager2->getFirstPage(),'class=link_big_dark') ?>
<?php echo link_to('<', 'messagebox/list?page2='.$pager2->getPreviousPage(),'class=link_big_dark') ?>
<?php $links = $pager2->getLinks(); foreach ($links as $page2): ?>
<?php echo ($page2 == $pager2->getPage()) ? $page2 : link_to($page2, 'messagebox/list?page2='.$page2,'class=link_big_dark') ?>
<?php if ($page2 != $pager2->getCurrentMaxLink()): ?> - <?php endif ?>
<?php endforeach ?>
<?php echo link_to('>', 'messagebox/list?page2='.$pager2->getNextPage(),'class=link_big_dark') ?>
<?php echo link_to('»', 'messagebox/list?page2='.$pager2->getLastPage(),'class=link_big_dark') ?>
<?php endif ?>
</div>
</div>
can anyone give some advise please?
i have no ajax/JS here so dont know how i would incorporate it
PHP is a server side language and will not update a page once it has been fetched by the browser. To do this you will need to use a combination of server side and client side scripts.
One way of making your page update it's content is to use AJAX (http://api.jquery.com/jQuery.ajax/) combined with a timer (setInterval() and setTimeout()) to query a PHP script and check for updates every x seconds. The updates can then be added to the page when they are available using JavaScript / jQuery.