PDA

View Full Version : Horizontal problem


0810
11-15-2002, 08:45 PM
how to show up my results horizontally
hi how are you doing?

I would like to show my result from mydatabase horizontally.

When a user reserches something from mysite, then results come up horizontally not vertically.

so I would like to know to show up my results from my database horizontally.

Here is my script. Now this script doesn't work. I used "table" but not working
Thanks





for($i=0; $i<$num_results; $i++)
{
$row=mysql_fetch_array($result);

echo"<table border=1 cellpadding=0 cellspacing=0 width=100%>";
echo"<tr>";

echo "<td>".($i+1).".Name:</td> ";

echo"<td> htmlspecialchars( stripslashes($row["name"]))</td>";
echo"<td rowspan=3><img src=\"$row[images]\" width=180 height=160></td>"

echo"</tr>";

echo"<tr>";

echo"<td>Country:</td> ";
echo "<td>htmlspecialchars( stripslashes($row["country"]))</td>";
echo"</tr>";
echo"<tr>";
echo"<td>Age:</td>";
echo "<td>htmlspecialchars( stripslashes($row["country"]))</td>";
echo "</tr>";

echo"<table>";

}

?>

firepages
11-15-2002, 11:44 PM
well I dont really know what your output is supposed to look like but I guess that along these lines ?? note that its much quicker (from a processing perspective) to NOT echo everything rather to jump in and out of PHP when possible...


<?
$result=mysql_query .... etc
?>
<table>
<tr>
<?while($row=mysql_fetch_array($result)){?>
<td>
<table border=1 cellpadding=0 cellspacing=0 width=100%>
<tr>
<td><?echo ($i+1);?>Name:</td>
<td><?echo htmlspecialchars( stripslashes($row["name"]));?></td>
<td rowspan=3><img src="<?echo $row[images];?>" width=180 height=160></td>
</tr><tr>
<td>Country:</td>
<td><?echo htmlspecialchars( stripslashes($row["country"]));?></td>
</tr><tr>
<td>Age:</td>
<td><?echo htmlspecialchars( stripslashes($row["country"]));?></td>
</tr>
</table>
</td>
<?}?>
</tr>
</table>

0810
11-16-2002, 02:32 AM
What I am trying to do is, let's say when a user searches Japan's picture from database, it comes 10 pictures.

In that case I would like to show Japan's pictures Horizontally.

Like this

Picture 1 Pcuture2 Picture3
picture 4 Picture 5 Picture6
Picture 7 Picture 8 Picture 9
Picture 10

but now

it comes out Japan's picture like this
Picture1
Picture2
"3
'4
and so on

I would like to show my results from my database horizontally as I explain to you.

Do you have any idea???

kwhubby
11-16-2002, 07:28 AM
well, <tr> makes a new row, so if you didn't want it to go to a next row each time, dont use <tr></tr>, just deleate them.