Hello,
once again me and sorry for my bad english....
I whant to list all product who are in more than one shop. I wrote following:
<?php
require("config.php");
require("includes/database.php");
$sql = "SELECT name as Products FROM products GROUP BY name HAVING count(name) > 1 ";
database_querySelect($sql,$rows);
$Products = $rows[0]["Products"];
print "<p>Products: ".$Products."</p>";
?>
But it shows me only one product. Which mistake did i made? Or i´m blind :)
Thanks a lot for your help, Peter
Hello David,
wow, fast answer...
it works great but you forgot a -s- by
foreach($rows as $row)
foreach($rows as $rows)
but it dosn´t matter. Thank you very much for your great support!
Cheers
Peter
Hello Peter,
$rows is returned as an array where $rows[x] refers to row x of the results. The best way is to use foreach to display each product:
<?php
require("config.php");
require("includes/database.php");
$sql = "SELECT name FROM products GROUP BY name HAVING count(name) > 1 ";
database_querySelect($sql,$rows);
foreach($rows as $row)
{
print "<p>".$rows["name"]."</p>";
}
?>
Cheers!
David