smithster
06-03-2007, 08:59 PM
It was a bit hard to discribe this topic in the subject so please feel free to amend it to something better!!
Here's the script in original working form...
$query = "SELECT `Name`, `Country`, `Location` FROM `approved`";
$result = mysql_query($query)
or die(mysql_error());
?>
<center>
<table border="5" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="80%" id="AutoNumber1" bgcolor="#C0C0C0">
<tr>
<td width="20%" align="center" bgcolor="#FFFFcc"><b>Name</b></td>
<td width="20%" align="center" bgcolor="#FFFFcc"><b>Country</b></td>
<td width="20%" align="center" bgcolor="#FFFFcc"><b>Location</b></td>
</tr>
<?php
while(list($Name, $Country, $Location)=mysql_fetch_row($result))
{
?>
<tr>
<td width="20%" align="center"><b><font color="#0000FF">=</font><font color="#FFFFFF">(</font><font color="#00FFFF">SC</font><font color="#FFFFFF">)</font><font color="#0000FF">=</font><span class="name-firstletter"><?php echo($Name[0]); ?></span><span class="name-rest"><?php echo(substr($Name, 1)); ?></span></b></td>
<td width="20%" align="center"><?php echo($Country);?></td>
<td width="20%" align="center"><?php echo($Location);?></td>
</tr>
<?php
}
Basically, when my data is outputted it looks something like this.....
--------------------------------------------------------
| ID | | Name | | Country | | Location |
--------------------------------------------------------
| 1 | | "name" | | "country" | | "location" |
---------------------------------------------------------
The problem I have with this is I have 19 fields which causes the table to be so long across the page. It would be better if I could have the fields going down instead of across. I have tried to do it myself but all that happens is this.....
----------------------------------
| ID | | 1 |
---------------------------------
| Name | | "name" |
----------------------------------
| Country | | "country" |
----------------------------------
| Location | | "location" |
----------------------------------
| ID | | 2 |
---------------------------------
| Name | | "name" |
----------------------------------
| Country | | "country" |
----------------------------------
| Location | | "location" |
----------------------------------
What I want is this............
---------------------------------------------------
| ID | | 1 | | 2 |
---------------------------------------------------
| Name | | "name" | | "name" |
---------------------------------------------------
| Country | | "country" | | "country" |
---------------------------------------------------
| Location | | "location" | | "location" |
----------------------------------------------------
Here's my script for the output so far.....
<?php
$query = "SELECT * FROM approved";
$result = mysql_query($query)
or die(mysql_error());
while(list($id, $Name, $Country, $Location)=mysql_fetch_row($result))
{
?>
<table border="5" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="40%" id="AutoNumber1" bgcolor="#C0C0C0">
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>ID</b></td>
<td width="50%"><?php echo($id);?></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>Name</b></td>
<td width="50%"><?php echo($Name);?></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>Country</b></td>
<td width="50%"><?php echo($Country);?></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>Location</b></td>
<td width="50%"><?php echo($Location);?></td>
</tr>
<?php
}
?>
</table>
</center>
Hope this helps someone to help me! Thanks in advance.
Here's the script in original working form...
$query = "SELECT `Name`, `Country`, `Location` FROM `approved`";
$result = mysql_query($query)
or die(mysql_error());
?>
<center>
<table border="5" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="80%" id="AutoNumber1" bgcolor="#C0C0C0">
<tr>
<td width="20%" align="center" bgcolor="#FFFFcc"><b>Name</b></td>
<td width="20%" align="center" bgcolor="#FFFFcc"><b>Country</b></td>
<td width="20%" align="center" bgcolor="#FFFFcc"><b>Location</b></td>
</tr>
<?php
while(list($Name, $Country, $Location)=mysql_fetch_row($result))
{
?>
<tr>
<td width="20%" align="center"><b><font color="#0000FF">=</font><font color="#FFFFFF">(</font><font color="#00FFFF">SC</font><font color="#FFFFFF">)</font><font color="#0000FF">=</font><span class="name-firstletter"><?php echo($Name[0]); ?></span><span class="name-rest"><?php echo(substr($Name, 1)); ?></span></b></td>
<td width="20%" align="center"><?php echo($Country);?></td>
<td width="20%" align="center"><?php echo($Location);?></td>
</tr>
<?php
}
Basically, when my data is outputted it looks something like this.....
--------------------------------------------------------
| ID | | Name | | Country | | Location |
--------------------------------------------------------
| 1 | | "name" | | "country" | | "location" |
---------------------------------------------------------
The problem I have with this is I have 19 fields which causes the table to be so long across the page. It would be better if I could have the fields going down instead of across. I have tried to do it myself but all that happens is this.....
----------------------------------
| ID | | 1 |
---------------------------------
| Name | | "name" |
----------------------------------
| Country | | "country" |
----------------------------------
| Location | | "location" |
----------------------------------
| ID | | 2 |
---------------------------------
| Name | | "name" |
----------------------------------
| Country | | "country" |
----------------------------------
| Location | | "location" |
----------------------------------
What I want is this............
---------------------------------------------------
| ID | | 1 | | 2 |
---------------------------------------------------
| Name | | "name" | | "name" |
---------------------------------------------------
| Country | | "country" | | "country" |
---------------------------------------------------
| Location | | "location" | | "location" |
----------------------------------------------------
Here's my script for the output so far.....
<?php
$query = "SELECT * FROM approved";
$result = mysql_query($query)
or die(mysql_error());
while(list($id, $Name, $Country, $Location)=mysql_fetch_row($result))
{
?>
<table border="5" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="40%" id="AutoNumber1" bgcolor="#C0C0C0">
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>ID</b></td>
<td width="50%"><?php echo($id);?></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>Name</b></td>
<td width="50%"><?php echo($Name);?></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>Country</b></td>
<td width="50%"><?php echo($Country);?></td>
</tr>
<tr>
<td width="50%" bgcolor="#FFFFcc"><b>Location</b></td>
<td width="50%"><?php echo($Location);?></td>
</tr>
<?php
}
?>
</table>
</center>
Hope this helps someone to help me! Thanks in advance.