try like this
$sql = "SELECT * FROM products, category WHERE category.name_category=products.name_category and category_id=".$_GET['category_id']." GROUP BY products.mark_name";
-------Original Message-------
Date: Wednesday, July 09, 2003 09:51:08 PM
Subject: Re: [PHP] Big problem....need help
It isn't work. it gives me an error at this line.
----- Original Message -----
Sent: Wednesday, July 09, 2003 4:49 PM
Subject: Re: [PHP] Big problem....need help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Le Mercredi 9 Juillet 2003 15:13, phpu a écrit :
> I have a table like this:
> ......
> $sql = "SELECT * FROM products, category WHERE
> category.name_category=products.name_category and
> category_id=".$_GET['category_id'] ;
>
> When i choose the category catg 1 the result is
> Name: aaa
> Name: aaa
> Name: ddd
>
> As you can see the name aaa appears 2 times insted 1.
> How to make the result look like this:
> Name: aaa
> Name: ddd
Use "GROUP BY" ....
$sql = "SELECT * FROM products, category WHERE
category.name_category=products.name_category and
category_id=".$_GET['category_id'] GROUP BY products.mark_name;
- --
,,
(°> Nicolas Costes
/|\ IUT de La Roche / Yon
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE/DB2GNc2aXy7LuOgRAmE6AKCIeGpWg78san/72M7vbhwJXQKXbQCfVxAJ
OgayWbAh0cOXc5OCdVy2uWs=
=vH6U
-----END PGP SIGNATURE-----
--
--
|