I'm joining 2 tables:
- girls
- pictures
each girl has a respective pic
CODE:
$result = mysql_query("select t1.name, t2.pic from girls as t1, pictures as t2;");
$g_array = array();
for ($count=0; $row = mysql_fetch_array($result); $count++)
$g_array[$count] = $row;
foreach ($g_array as $row)
{
echo $row["name"];
echo $row["pic"]."<br>";
}
Lets say i have only 2 girls in the database.
the result:
instead of giving me
girl 1 name girl 1 pic
girl 2 name girl 2 pic
I get:
girl 1 name girl 1 pic
girl 1 name girl 2 pic
girl 2 name girl 1 pic
girl 2 name girl 2 pic
the code is counting the 2 rows of each table and summing it...
HOW TO AVOID IT TO HAPPEN???
thanks in advance