hello.
i have a problem with a populate html table with data from table here
it's the problem
two querys retrieving data from table, one of querys show me a
colletion of data from 6:00 am to 15:30 pm timestampz, i put this on a
part of html table. when time on my if condition es great than 15:31,
showme data from 15:31 to 23:59 timestamp and populate another part of
html table.
but, data in html first part,it's gone away.
how can i put on html table data from two querys in same table? 3 2013
Chifo wrote: hello. i have a problem with a populate html table with data from table here it's the problem
two querys retrieving data from table, one of querys show me a colletion of data from 6:00 am to 15:30 pm timestampz, i put this on a part of html table. when time on my if condition es great than 15:31, showme data from 15:31 to 23:59 timestamp and populate another part of html table. but, data in html first part,it's gone away. how can i put on html table data from two querys in same table?
By running the first query, fetch the data, display it, run the second
query, fetch the data, and display it? Just don't close the table an open
another in between....
Without code, it's difficult to see what you're doing wrong.
This should be absolutely no problem at all
Keep in mind that you might have to choose different names for variables
you're used to call a certain name, to prevent overwriting them. Also: you
don't really put something into a table, you just return your results
surrounded by echoing some markup, so it's not that much different then just
spitting out raw data.
Grtz,
--
Rik Wasmus
Chifo wrote: but, data in html first part,it's gone away. how can i put on html table data from two querys in same table?
<?php
$table1 = "<table>\n"
. "<caption>15:30 and earlier</caption>\n"
. "<tr><th>Time</th><th>Thingy</th></tr>\n";
$table2 = "<table>\n"
. "<caption>15:31 and later</caption>\n"
. "<tr><th>Time</th><th>Thingy</th></tr>\n";
$results = pg_query($db, "SELECT time,thingy FROM mydata ORDER BY thingy;");
while($row = pg_fetch_assoc($results))
{
$time = strtotime($row['time']);
$trow = sprintf("<tr><td>%s</td><td>%s</td></tr>\n"
,htmlentities(date('H:m', $time))
,htmlentities(substr($row['thingy'], 0, 200))
);
if (date('Hm', $time) > 1530)
$table1 .= $trow;
else
$table2 .= $trow;
}
$table1 .= "</table>\n";
$table2 .= "</table>\n";
print $table1."<hr>\n".$table2;
?>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
here is the code
<meta http-equiv="refresh" content="60">
<?php
$line=$_GET['Linea'];
include ("conexion.php");
$shift1BeginHour=date("Y-m-d")." "."12:00:00";
$shift1EndHour=date("Y-m-d")." "."21:29:00";
$shift2BeginHour=date("Y-m-d")." "."21:30:00";
$YearMonths=date("Y-m");
$day=date("d");
$nextDay=$day+1;
$shift2EndHour=$YearMonths."-".$nextDay." "."05:59:00";
/*date("Y-m-d")." "."05:59:00";*/
/*************************************************v ARIABLES PARA
SHIFT2******************************************** **********/
$percentYield2=0;
$totalYield2=0;
$newPartS=array();
$newQtyS=array();
$newFpyS=array();
$newPartS1=array();
$newQtyS1=array();
$newFpyS1=array();
$total2=0;
$newPart1s=array();
$newQty1s=array();
$newFpy1s=array();
$totalYs=array();
$totalYields=0;
/************************************************** ************************************************** ************************/
$meta=0;
$meta2=0;
/*$meta_x_hora= $meta / 8.5;*/
$total=0;
$shift1Total=0;
$shift1TotalReal=0;
$percent=0;
$rate=0;
$expected_rate=0;
$totalFpy=0;
$j=0;
$percentYield=0;
$totalYield=0;
$newPart=array();
$newQty=array();
$newFpy=array(10);
$newPart1=array(10);
$newQty1=array(10);
$newFpy1=array(10);
$totalY=array(10);
$ProdDaysS1=array(10);
$ProdDaysS2=array(10);
$i=0;
$result=pg_query("SELECT part_no, COUNT(part_no) as partes,
COUNT(fts_count) as fpy FROM table WHERE prod_day =extract(doy from
current_date) AND id_prefix = 'CAX' AND cell_nb =$line and fts_count=1
GROUP BY part_no ORDER BY partes ") or die ("No se ejecuto el query" .
pg_last_error());
/* $result1=pg_query("select part_no, COUNT(part_no) as partes,
COUNT(fts_count) as fpy from vw_wip_fpy_top where prod_day =
extract(doy from current_date) and id_prefix = 'CAX' and ship_time
between '$shift1BeginHour'::timestamptz and
'$shift1EndHour'::timestamptz
and cell_nb =$line GROUP BY part_no order by
part_no") or die ("No se ejecuto el query" . pg_last_error());
while($rows1=pg_fetch_array($result1)){
$newPart[]=$rows1[0];
$newQty[]=$rows1[1];
$newFpy[]=$rows1[2];
$total+=$rows1[1];
;/*Produccion Actual sacado del query*/
include ("shift1and2.php");
$horaActual=Date("H:i");
while($rows=pg_fetch_array($result)){
$newPart1[]=$rows['part_no'];
$newQty1[]=$rows['partes'];
$newFpy1[]=$rows['fpy'];
$totalYield+=$rows['fpy'];
$totalY[]=$rows['partes'];
}
/**********************************Codigo agregado
17/04/7006*************************************/
$FirstP=$totalYield;
?><title>Production Information</title>
<style type="text/css">
<!--
..style1 {
color: #0089C0;
font-weight: bold;
font-size: large;
}
..style9 {font-size: large; font-weight: bold; }
..style10 {font-family: Arial, Helvetica, sans-serif}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
..style12 {color: #FFFFFF; font-weight: bold; font-size: large; }
..style13 {font-size: large}
..style14 {
font-family: Arial, Helvetica, sans-serif;
font-size: large;
font-weight: bold;
}
-->
</style>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"><table width="1221" height="461" border="2"
align="center" cellspacing="0" bordercolor="#000000">
<tr>
<td width="1213" valign="top"><div id="Layer3"
style="position:absolute; width:861px; height:71px; z-index:3; left:
68px; top: 76px;">
<table width="825" height="70" border="1" align="center"
cellspacing="0" bordercolor="#000000">
<tr>
<td width="598" height="31">
<?
if($horaActual>="06:00" and $horaActual<$shift1[8]){
$result1=pg_query("select part_no, COUNT(part_no) as
partes, COUNT(fts_count) as fpy from table where prod_day =
extract(doy from current_date) and id_prefix = 'CAX' and ship_time
between '$shift1BeginHour'::timestamptz and
'$shift1EndHour'::timestamptz
and cell_nb =$line GROUP BY part_no order by
part_no") or die ("No se ejecuto el query" . pg_last_error());
while($rows1=pg_fetch_array($result1)){
$newPart[]=$rows1['part_no'];
$newQty[]=$rows1['partes'];
$newFpy[]=$rows1['fpy'];
$total+=$rows1['partes'];
}
$s1=$total;
if ($line=1 or $line=2 or $line=5 or $line=12){
$meta=450;
$meta2=400;
for ($i=1;$i<=8;$i++){
$ProdDays1[$i]=$meta/7.5;
}
for ($i=1;$i<=7;$i++){
$ProdDaysS2[$i]=$meta2/6.5;
}
}
if ($line=3 or $line=13){
$meta=650;
$meta2=575;
for ($i=1;$i<=8;$i++){
$ProdDays1[$i]=$meta/7.5;
}
for ($i=1;$i<=7;$i++){
$ProdDaysS2[$i]=$meta2/6.5;
}
}
if ($line=7 or $line=8 or $line=9 or $line=10 or $line=11 or $line=14
or $line=15 or $line=17){
$meta=774;
$meta2=683;
for ($i=1;$i<=8;$i++){
$ProdDays1[$i]=$meta/7.5;
}
for ($i=1;$i<=7;$i++){
$ProdDaysS2[$i]=$meta2/6.5;
}
}
$rate=($total/$meta)*100;
$expected_rate=$rate*7.5;
if ($horaActual>$shift1[0] && $horaActual<$shift1[1]) {/*7:00 am
produccion=53;*/
if ($total <= $expected_rate){
echo "<img src=rojo.gif width=$total height=70>";
}
else
{
echo "<img src=verde.gif width=$total height=70>";
}
}
if ($horaActual>$shift1[1] && $horaActual<$shift1[2]) {/*8:00
am produccion=106;*/
if ( $total<= $expected_rate){
echo "<img src=rojo.gif width=$total height=70>";
;
}
else
{
echo "<img src=verde.gif width=$total height=70>";
}
}
if ($horaActual>$shift1[2] && $horaActual<$shift1[3])
{/*9:00 am produccion =159*/
if ($total <= $expected_rate){
echo "<img src=rojo.gif width=$total
height=70>";
}
else
{
echo "<img src=verde.gif width=$total
height=70>";
}
}
if ($horaActual>$shift1[3] &&
$horaActual<$shift1[4]) {/*10:00 am produccion=212;*/
if ($total <=$expected_rate ){
echo "<img src=rojo.gif
width=$total height=70>";
}
else
{
echo "<img src=verde.gif
width=$total height=70>";
}
}
if ($horaActual>$shift1[4]
&& $horaActual<$shift1[5]) {/*11:00 am produccion=265;*/
if ($total
<=$expected_rate){
echo "<img
src=rojo.gif width=$total height=70>";
}
else
{
echo "<img
src=verde.gif width=$total height=70>";
}
}
if ($horaActual>$shift1[5] &&
$horaActual<$shift1[6]) {/*12:00 produccion=318;*/
if ($total <= $expected_rate){
echo
"<img src=rojo.gif width=$total height=70>";
}
else
{
echo
"<img src=verde.gif width=$total height=70>";
$ProdDays1[5];
}
}
if ($horaActual>$shift1[6]
&& $horaActual<$shift1[7]) {/*13:00 produccion=370;*/
if ($total <= $expected_rate){
echo
"<img src=rojo.gif width=$total height=70>";
}
else
{
echo
"<img src=verde.gif width=$total height=70>";
}
}
if ($horaActual>$shift1[7] &&
$horaActual<$shift1[8]) {/*14:00 produccion=423;*/
if ($total <= $expected_rate){
echo
"<img src=rojo.gif width=$total height=70>";
}
else
{
echo
"<img src=verde.gif width=$total height=70>";
}
}
if ($horaActual>$shift1[8] &&
$horaActual<$shift2[0]) {/*15.30:00 produccion=470;*/
if
($total <=$expected_rate ){
echo
"<img src=rojo.gif width=$total height=70>";
}
else
{
echo
"<img src=verde.gif width=$total height=70>";
}
}
}
/*pg_free_result($result1);
pg_free_result($result);*/
if($horaActual>="15:30" and $horaActual<$shift2[7]){
include ("conexion.php");
$totalshift2=pg_query("select part_no, COUNT(part_no) as partes,
COUNT(fts_count) as fpy from table where prod_day = extract(doy from
current_date) and id_prefix = 'CAX' and ship_time between
'$shift2BeginHour'::timestamptz and '$shift2EndHour'::timestamptz
and cell_nb = $line GROUP BY part_no ORDER BY part_no") or die ("No se
ejecuto el query" . pg_last_error());
$resultShift2=pg_query("SELECT part_no, COUNT(part_no) as partes,
COUNT(fts_count) as fpy FROM table WHERE prod_day =extract(doy from
current_date) AND id_prefix = 'CAX' and ship_time between
'$shift2BeginHour'::timestamptz and '$shift2EndHour'::timestamptz AND
cell_nb =$line and fts_count=1 GROUP BY part_no ORDER BY part_no") or
die ("No se ejecuto el query" . pg_last_error());
while($rowshift2=pg_fetch_array($resultShift2)){
$newPart1s[]=$rowshift2[0];
$newQty1s[]=$rowshift2[1];
$newFpy1s[]=$rowshift2[2];
$totalYields+=$rowshift2[2];
$totalYs[]=$rowshift2[2];
}
while($rows2=pg_fetch_array($totalshift2)){
$newPartS[]=$rows2[0];
$newQtyS[]=$rows2[1];
$newFpyS[]=$rows2[2];
$total2+=$rows2[1];
}
/************************************************** ************************************************** ******************/
if ($line=1 or $line=2 or $line=5 or $line=12){
$meta2=400;
for ($i=1;$i<=7;$i++){
$ProdDays2[$i]=$meta2/6.5;
}
}
if ($line=3 or $line=13){
$meta2=575;
for ($i=1;$i<=7;$i++){
$ProdDays2[$i]=$meta2/7.5;
}
}
if ($line=7 or $line=8 or $line=9 or $line=10 or $line=11 or $line=14
or $line=15 or $line=17){
$meta2=683;
for ($i=1;$i<=7;$i++){
$ProdDays2[$i]=$meta2/7.5;
}
}
/************************************************** ************************************************** ******************/
$rate=($total2/$meta2)*100;
$expected_rate=$rate*7.5;
if ($horaActual>$shift1[0] && $horaActual<$shift2[1]) {/*16:30
produccion=53;*/
echo $shift2[1];
if ($total2 <= $expected_rate){
echo "<img src=rojo.gif width=$total2 height=70>";
}
else
{
echo "<img src=verde.gif width=$total2 height=70>";
}
}
if ($horaActual>$shift2[1] && $horaActual<$shift2[2]) {/*17:30
produccion=106;*/
if ( $total2<= $expected_rate){
echo "<img src=rojo.gif width=$total2 height=70>";
}
else
{
echo "<img src=verde.gif width=$total2 height=70>";
}
}
if ($horaActual>$shift2[2] && $horaActual<$shift2[3])
{/*18:30 produccion =159*/
if ($total2 <= $expected_rate){
echo "<img src=rojo.gif width=$total2 height=70>";
echo $horaActual;
}
else
{
echo "<img src=verde.gif width=$total2 height=70>";
}
}
if ($horaActual>$shift2[3] && $horaActual<$shift2[4])
{/*19:30 produccion=212;*/
if ($total2 <=$expected_rate ){
echo "<img src=rojo.gif width=$total2
height=70>";
}
else
{
echo "<img src=verde.gif width=$total2
height=70>";
}
}
if ($horaActual>$shift2[4] &&
$horaActual<$shift2[5]) {/*20:30 produccion=265;*/
if ($total2 <=$expected_rate ){
echo "<img src=rojo.gif width=$total2
height=70>";
}
else
{
echo "<img src=verde.gif width=$total2
height=70>";
}
}
if ($horaActual>$shift2[5] && $horaActual<$shift2[6])
{/*21:30 produccion=318;*/
if ($total2 <= $expected_rate){
echo "<img src=rojo.gif width=$total2
height=70>";
}
else
{
echo "<img src=verde.gif
width=$total2 height=70>";
}
}
if ($horaActual>$shift2[6] && $horaActual<$shift2[7])
{/*22:30 produccion=370;*/
if ($total2 <= $expected_rate){
echo "<img src=rojo.gif
width=$total2 height=70>";
}
else
{
echo "<img src=verde.gif
width=$total2 height=70>";
}
}
if ($horaActual>$shift2[7] && $horaActual<$shift1[0])
{/*23:30 produccion=423;*/
if ($total2 <= $expected_rate){
echo "<img src=rojo.gif
width=$total2 height=70>";
}
else
{
echo "<img
src=verde.gif width=$total2 height=70>";
}
}
}
?>
</td>
</tr>
</table>
</div>
<p><?=$horaActual;?></p>
<div id="Layer2" style="position:absolute; width:242px; height:70px;
z-index:2; left: 952px; top: 118px;">
<table width="243" bordercolor="#000000">
<tr bgcolor="#f87870">
<td width="73" bgcolor="#173a60"><span
class="style12">Rate</span></td>
<td width="270" bgcolor="#173a60"><span class="style12">Expected
Rate </span></td>
</tr>
<tr >
<? if($horaActual>="06:00" and $horaActual<"15:30"){?>
<? $percentYield=($totalYield/$total)*100?>
<td><div align="center"><span class="style14"><? echo
number_format($rate,2); ?></span></div></td>
<td><div align="center"><span class="style14"><? echo
number_format($expected_rate,2);?></span></div></td>
</tr>
<? }?>
<!-- /*******************rate segundo
turno******************************************/ -->
<? if($horaActual>="15:30" and $horaActual<"23:59"){?>
<td><div align="center"><span class="style14"><? echo
number_format($rate,2); ?></span></div></td>
<td><div align="center"><span class="style14"><? echo
number_format($expected_rate,2);?></span></div></td>
</tr>
<? }?>
</table>
</div>
<p> </p>
<p> </p>
<p><br>
<br>
<br>
</p>
<table width="820" height="92" bordercolor="#000000">
<tr >
<td width="34" rowspan="6"> </td>
<td width="195" height="28" bgcolor="#173a60"><span
class="style12">Produced Model </span></td>
<td width="51" bgcolor="#173a60"><span
class="style12">Qty</span></td>
<td width="80" bgcolor="#173a60"><span
class="style12">FPY%</span></td>
<td width="122" bgcolor="#173a60"><span class="style12">FPY
S1</span></td>
<td width="168" bgcolor="#173a60"><span
class="style12">Shift2</span></td>
<td width="138" bgcolor="#173a60"><span class="style12">FPY
S2</span></td>
</tr>
<tr >
<? if($horaActual>="06:00" and $horaActual<$shift1[8]){?>
<? for ($j=0;$j<pg_num_rows($result1);$j++){?>
<td height="20" > <div align="left" class="style10
style13"><strong><? echo $newPart[$j];?> </strong></div></td>
<? $percent=($totalY[$j]/$newQty[$j])*100;?>
<td><div align="center" class="style14"><? echo
$newQty[$j];?></div></td>
<td><div align="center" class="style14"><? echo
number_format($percent,2); ?></div></td>
<? /*$Quant=$percent;*/?>
<td><div align="center" class="style14"><? echo
$newFpy1[$j];?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr> <? } ?> <? }?>
<!-- /*******************Produccion segundo
turno******************************************/ -->
<? if($horaActual>="15:30" and $horaActual<$shift2[7]){?>
<? for ($j=0;$j<pg_num_rows($totalshift2);$j++){?>
<tr>
<td height="31" > <div align="left" class="style10
style13"><strong><? echo $newPartS[$j];?> </strong></div></td>
<? $percentYield2=($totalYields[$j]/$newQtyS[$j])*100;?>
<td><div align="center" class="style14"><?=$s1;?></div></td>
<td><div align="center" class="style14"></div></td>
<td><div align="center" class="style14">
<?=$FirstP;?>
</div></td>
<td><div align="center"><span class="style14"><? echo
$newQtyS[$j];?></span></div></td>
<td><div align="center"><span class="style14"><? echo
$newFpy1s[$j]?></span></div></td>
</tr> <? } ?> <? }?>
</table>
<br>
<div id="Layer1" style="position:absolute; width:247px; height:51px;
z-index:1; left: 949px; top: 230px;">
<table width="246" bordercolor="#000000">
<tr >
<td width="109" bgcolor="#173a60"><div align="center"><span
class="style12">Produced</span></div></td>
<td width="85" bgcolor="#173a60"><div align="center"><span
class="style12">Yield</span></div></td>
</tr>
<tr ><? if($horaActual>="06:00" and $horaActual<"15:30"){?>
<td><div align="center"><span class="style14">
<?=number_format($total,2); ?>
</span></div></td>
<td><div align="center"><span class="style14">
<?=number_format($percentYield,2)." "."%"; ?>
</span></div></td>
</tr><br>
<? } ?>
<!-- /*******************Produce and Yield segundo
turno******************************************/ -->
<? if($horaActual>="15:30" and $horaActual<"23:59"){?>
<td><div align="center"><span class="style14">
<?=number_format($total2,2); ?>
</span></div></td>
<td><div align="center"><span class="style14">
<? if ($totalyields=0 and $total=0) {
$totalYield2=0;
}
else
{
$totalYield2=($totalYields/$total2)*100;
echo number_format($totalYield2,2)." "."%";
}?>
</span></div></td>
</tr><br><? }?>
</table>
<span class="style14"> </span></div>
<table width="821" height="27" bordercolor="#000000">
<tr>
<td width="169"><span class="style1">Total</span></td>
<td width="46"><div align="center"><span class="style9">
<?=number_format($total,0); ?>
</span></div></td>
<td width="113"><div align="center"></div></td>
<td width="121"><div align="center"></div></td>
<!-- /*******************Total segundo
turno******************************************/ -->
<? if($horaActual>="15:30" and $horaActual<$shift2[7]){?>
<td width="179"> <div align="center"><span
class="style9"><?=$total2; ?>
</span></div></td><? }?>
<td width="128"><div align="center"></div></td>
</tr>
</table>
</td>
</tr>
</table> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: raulgz |
last post by:
hi
I need generate dinamic sql:
I need a select sentence with all fields of one table 't1'
and all fields of tables which 't1' have foreings keys 't1 ( reflexive ) ,t2,t3,...'
Now, l have de...
|
by: dddddd |
last post by:
i need do create simple dinamic site - built mainly
of pictures(they are the only dinamic part).
pictuers differ by the -Location- and by -Time- (in which
they were taken)... so on the index...
|
by: Jose Garcia |
last post by:
Hi there,
Can somebody explain me how can i use matrixes with dinamic memory? I
use malloc and free (NOT new & delete). I want to access to the matrix
like Matrix but i don't know how to do that...
|
by: gp |
last post by:
Hi all,
I'm using Microsoft Visual C++ 6.0,
I would like to see, debugging my project, all the elements of my dinamic
objects....
I have a dinamic array and a STL vector and I need to know...
|
by: John Phelan-Cummings |
last post by:
I'm not certain if this made the post. Sorry if it's a repeat:
Using a Button to take an autonumber from one form to populate another
autonumber field on another form.
I have a Mainform "A"...
|
by: rn5a |
last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB
table. The records retrieved depends upon 2 conditions (the conditions
depend on what a user selects in an ASPX page). If...
|
by: joshua.nicholes |
last post by:
I have an access database that consists of two tables.A data
collection table and a species list table. The data collection table
has about 1500 records in it and the species list has about 600....
|
by: SimpDogg |
last post by:
Hey guys another Newbie here...
I have a combobox(JobName) on my form tied to a
table named (Jobs) with one field for all of the
jobs in the comboxbox. I want to auto populate the
Due Out Date...
|
by: KMEscherich |
last post by:
Using Access '97
Hi there, am wondering if someone can please help me with the following:
I have a master table (T_INVESTIGATION) that contains the following fields as well as other fields.
...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |