Re: Logic not working...

From: Date: Sun, 11 May 2003 17:59:08 +0000
Subject: Re: Logic not working...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147220@lists.php.net to get a copy of this message
Hi, Monday, May 12, 2003, 3:44:51 AM, you wrote: RA> Hi guys, RA> Been breaking my head on this for the past hour or so, see if you have RA> better luck (you might as i am new to arrays) :-) RA> Basically I have 3 packages (ryan1,ryan2,ryan3) RA> under those packages i have some sub packages RA> If you goto this url you will see what i mean: RA> http://bestwebhosters.com/test.php RA> As you can see its displaying everything correctly except that its skipping RA> "ryan1" RA> What do i do to make it show all the packages properly? RA> The code is below... RA> PLEASE HELLLLLP. RA> Thanks in advance. RA> -Ryan RA> <?php RA> $connected=mysql_connect("localhost","bestweb_test","test") or RA> die RA> ('connect:'.mysql_error()); RA> mysql_select_db ("bestweb_test"); RA> $database["sql"] = " select * from testing order by company"; RA> print("<table width=50% border=1 align=center cellpadding=2 cellspacing=2>>"); RA> $company = ''; RA> if($result= mysql_query($database["sql"])) RA> { RA> while($row = mysql_fetch_row($result)) RA> { RA> if(empty($company)) RA> { $company = $row[1]; } RA> elseif($company != $row[1]) RA> { RA> print(" <tr><td RA> colspan=5><b>".$row[1]."</b></td></tr>"); RA> $company = $row[1]; RA> } RA> print("<tr> <td width=14%>".$row[0]."</td>"); RA> print(" <td width=19%>".$row[2]."</td>"); RA> print(" <td width=21%>".$row[3]."</td>"); RA> print(" <td width=35%>".$row[4]."</td>"); RA> print(" <td width=11%>".$row[5]."</td></tr>"); RA> }} RA> else RA> {print("Query error:");} RA> print("</table>"); ?>> I think this bit should be: { print(" <tr><td colspan=5><b>".$company."</b></td></tr>"); $company = $row[1]; } -- regards, Tom

« previous php.general (#147220) next »