Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2009, 09:06 AM   PM User | #1
cyn_di
New to the CF scene

 
Join Date: Jan 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
cyn_di is an unknown quantity at this point
Question array within an array problem

Hi guys, i need help with this..

here's the idea..
you need to input first a month and a year then display the years along with the active notams of each year based on the month and year entered..

if i entered 03/06
the output should be like this:

Series of '00

0011 0800 0899

Series of '05

0013 0504 0909

Series of '06

0014 0017 0018 0019 0022 0023 0029 0051
0057 0400 0608 0657 0980 0980 1088 1088
0226 0228 0229 0230 0232 0250 0251 0252


i was able to display the notam numbers accordingly..
the problem is..the succeeding years also display the active notam numbers of the previous years..i just need to output the notam numbers according to their year..

the years to be displayed are based on the lowest year on the database that has active notam numbers [here,the 'status' column should be '0']..and also on the month and year the user entered [it should be equal to or less than that]...
here's the code i used:

PHP Code:
<?
$month 
$_POST['month'];
$year $_POST['year'];
//for the query
$mod $year.$month ."31"

    
$qry9 "SELECT DISTINCT byear FROM bnotam WHERE status = 0 AND type <> 'C' AND dtg <= '$mod' AND byear <= '$year' ORDER BY byear ASC";
    
$result9 mysql_query($qry9);
    
//Check whether the query was successful or not
    
echo "<br>";
    
$nr9=0;
        while (
$row9 mysql_fetch_array($result9))
    {
        
$nr9++;
        echo 
"<pre>";
        echo 
"<table align='center' bgcolor='white' border='0' bordercolor='#003399' cellpadding='0' cellspacing='0' rules='groups' width='750'>";
        echo 
"<tr bordercolor='#003399' bgcolor='#FFFFFF'>"
         echo 
"<td width='750' height='50' colspan='13' nowrap='nowrap' align='left'>";
        echo 
"<b>Series of '".$row9[0]."</b>";
        echo 
"<br>";
        echo 
"<table align='justify' bgcolor='white' border='0' bordercolor='#003399' cellpadding='0' cellspacing='0' rules='groups' width='400'>";
        echo 
"<tr bordercolor='#003399' bgcolor='#FFFFFF'>"
         echo 
"<td width='400' height='50' colspan='13' nowrap='nowrap' align='justify'>";
        echo 
"<pre>";
        
//HERE GOES THE NOTAM NUMBERS
    
        //set the number of columns
                
$columns 13;
        
$qry10 "SELECT * FROM bnotam WHERE status = 0 AND type <> 'C' AND dtg <= '$mod' AND byear <= '$row9[0]' ORDER BY number ASC";
        
$result10 mysql_query($qry10);
        
        
$num_rows mysql_num_rows($result10);
    
  
echo 
"<TABLE BORDER=\"0\">\n";
for(
$i 0$i $num_rows$i++) {
    
$row10 mysql_fetch_array($result10);
    if(
$i $columns == 0) {
        
//if there is no remainder, we want to start a new row
        
echo "<TR>\n ";
        
    }
    echo 
"<TD>" $row10['number'] . "&nbsp;&nbsp;</TD>\n";
    if((
$i $columns) == ($columns 1) || ($i 1) == $num_rows) {
        
//if there is a remainder of 1, end the row
        //or if there is nothing left in our result set, end the row
        
echo "</TR>\n";
    }
    
    
}
echo 
"</TABLE>\n"

          echo 
"</pre>";
        echo 
"</td>";
        echo 
"</tr>";
        echo 
"</table>";
        echo 
"</td>";
        echo 
"</tr>";
        echo 
"</table>";
        }
?>
please help me with this..i think there's a problem with my array..
cyn_di is offline   Reply With Quote
Reply

Bookmarks

Tags
array, array within an array

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:21 PM.


Advertisement
Log in to turn off these ads.