PDA

View Full Version : SQL&PHP Search table merge.



ABM2007
01-27-2007, 06:58 PM
Hi guy's, im brand new here so please be gentle.

I have the following issue, i got a database with products, there are 18 collums. for example. search1 which contains a keyword for searching and url-small which contains a picture of the product.

The problem is this:
I have a simple search which will display all items in the database neatly in a table for every hit it gets.

But i want it to look for matching pictures, for example i use url-small to specify which products are the same. so when i have 3 products which look alike they will have the same url-small but a different specification.

So i'd want to get my results like this:

url-small
Product1
product2
product3

instead of:
url-small
Product1

url-small
Product2

url-small
Product3

I hope i'm making sence, excuse me for my language im dutch (A)
and i hope anyone can help me with this. the code i have so far is below:


while($result = @mysql_fetch_array( $data ))
{

echo "<a href=".$result['url-big']."><img src=".$result['url-small']."></a>";
echo $result['Article:'];
echo " ";
echo $result['Ordernumber:'];
echo "<br>";
echo $result['search1'];
echo "<br>";
echo $result['Search3'];
echo "<br>";
}

$anymatches=@mysql_num_rows($data);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}

Thanks sincerely,

ABM2007
01-27-2007, 08:34 PM
Do i have bad breath or something? :D

guelphdad
01-28-2007, 01:47 AM
no, you haven't waited any amount of time at all. This isn't a live chat forum, please don't bump your own posts after only two hours. People may not have had a chance to respond because they have not seen your post. Others may not know how to answer your post.

Read the albums/artists link in my signature. It will give you an idea you can adapt to do what you need. PHP code included.