I had one problem in php
below is the code which fetches campus id and campus name form the mysql database and store them in two variables and using while loop i had fetch all the records from the Related table (Campus) by the code below
Below is the HTML embedded code that i want to repeat
its a HTML table in which each campus name is fetched and shown and loop repeats itself until the last record is fetched
ending tag of the loop
My problem is that the loop always repeat the content vertical mean row wise
such as
( campus name 1
Campus name 2
campus name 3 )
but i want it to be shown horizontally
LIke this ( campus name 1 Campus name 2 campus name 3)
any idea can any one
below is the code which fetches campus id and campus name form the mysql database and store them in two variables and using while loop i had fetch all the records from the Related table (Campus) by the code below
Code:
<?php
$query="SELECT * FROM campuses ORDER BY campus_id ASC";
$result=mysql_query($query) or die(mysql_error());
$rClr="ffffff";
while($row=mysql_fetch_array($result)) {
if($rClr=="ffffff"){
$rClr="F7F7F7";
}else{
$rClr="ffffff";
}
$campid= $row['campus_id'];
$campnam= $row['campus_name'];
?>
its a HTML table in which each campus name is fetched and shown and loop repeats itself until the last record is fetched
Code:
<tr>
<td align="center" valign="middle"><table width="260" border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="center" valign="middle" style="background-repeat:no-repeat;" class="Eventheading"><a href="eventsdetail.php?camp_id=<?php print $campid?>&campus_name=<?php print $campnam ?>" class="Eventheading" ><?php echo $row['campus_name'];?></a></td>
</tr>
</table></td>
</tr>
Code:
<?php }?>
My problem is that the loop always repeat the content vertical mean row wise
such as
( campus name 1
Campus name 2
campus name 3 )
but i want it to be shown horizontally
LIke this ( campus name 1 Campus name 2 campus name 3)
any idea can any one
Comment