First, examine the code below:
//call database to create selection menu
$sql ="select * from (select * from table order by sequence) where rownum < 11";
$selectStmt =ociParse($connection,$sql);
ociExecute($selectStmt);
while(ociFetch($selectStmt))
{
$tableColumns = ociNumCols($selectStmt);
for($nc = 1; $nc <= $tableColumns; $nc++)
{
$column[(ociColumnName($selectStmt, $nc))] = ociResult($selectStmt, $nc);
}
print "$column[CUSTOMER] $column[SEQUENCE] $column[SENT] $column[RECEIVED] $column[STATUS]<br>";
//define blocks
$red = "<b style='mso-bidi-font-weight:normal'><span style='font-family:Wingdings;
mso-ascii-font-family:Arial;mso-hansi-font-family:Arial;color:red;mso-char-type:
symbol;mso-symbol-font-family:Wingdings'><span style='mso-char-type:symbol;
mso-symbol-font-family:Wingdings'>n</span></span></b>";
$lime = "<b style='mso-bidi-font-weight:normal'><span style='font-family:Wingdings;
mso-ascii-font-family:Arial;mso-hansi-font-family:Arial;color:lime;mso-char-type:
symbol;mso-symbol-font-family:Wingdings'><span style='mso-char-type:symbol;
mso-symbol-font-family:Wingdings'>n</span></span></b>";
//subtract sent from received
$track_time = ($column[RECEIVED] - $column[SENT]);
print "Track time is $track_time<br>";
//if received is empty, status is red
if(!$column[RECEIVED])
print $red;
//if track time is greater than or equal to 5 minutes, status is red
if($track_time >= 300)
print $red;
//if track time is less than 5 minutes, status is green
if($track_time < 300)
print $lime;
}
Here are my goals:
1)get the last 10 rows of the table ordered by sequence. right now it only retrieves the first 10 rows.
2)if there is no $column[RECEIVED], put $red into an array or something and move on to retrieve the next row. I'll be printing the 10 color boxes based on the logic defined in my goal list.
3)subtract SENT from RECEIVED, if the result is less than 5 minutes or 300 seconds, we'll need to use the green box...push to an array or something for later use. If the result is greater than or equal to 5 minutes or 300 seconds, we'll need to use the red box...and push to an array or something for later use.
Then when we have defined all 10 boxes based on the logic above, I need to print out the html code for the boxes in a straight line.
If I don't make sense, please don't hesitate to ask. I need all the help I can get and all answers are greatly appreciated.
If you know an easier way, please let me know. I won't get offended because I like doing things the easiest way!
Thanks!
Dave