PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
bickyz
Forum Newbie
Posts: 5 Joined: Tue Dec 01, 2009 12:54 pm
Post
by bickyz » Sat Feb 20, 2010 3:37 pm
hi i have this code which displays search results vertically, how do i display results horizontally like 4 records in per row.
Code: Select all
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
?>
<php?
mysql_connect("localhost","user1","password");
mysql_select_db("dbimages");
$search=$_POST["search"];
$field=$_POST["field"];
if ($search == "")
{
echo "<p>You forgot to enter a search term";
exit;
}
$result = mysql_query("SELECT * FROM tblimg WHERE upper($field) LIKE '%$search%'");
while($r=mysql_fetch_array($result))
{
$title=$r["firstname"];
$message=$r["surname"];
$imgurl=$r["imgurl"];
echo "$id <br> $title <br> $message <br> $imgurl <br>";
}
?>
daj
Forum Newbie
Posts: 5 Joined: Sat Feb 20, 2010 1:43 pm
Post
by daj » Sat Feb 20, 2010 3:44 pm
Probably the easiest way would be to put the results in a table and count when you have added 4 before moving to the next row.
The better way would be to create a list <UL> and display four in a row.
Are you familiar with any of these techniques?
bickyz
Forum Newbie
Posts: 5 Joined: Tue Dec 01, 2009 12:54 pm
Post
by bickyz » Sun Feb 21, 2010 5:18 am
sorry im not.
is it possible for you to brief the code here please, will be very grateful.