Hi, Can you please help me with my code?
What I want to do is display information from two or more tables. The information is uid and created form the users table, and field_gender_value from the field_data_field_gender table. The 2009 book learning SQL shows how to display information from one table, not 2.
My select statement show the information I need to display. However, each user id, gender, and created date are displayed seven times instead of once. What am I doing wrong?
<?php // query.php
require_once 'login.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
mysql_select_db($db_database)
or die("Unable to select database: " . mysql_error());
$query = "SELECT *FROM users,field_data_field_gender";
$result = mysql_query($query);
if (!$result) die ("Database access failed: " . mysql_error());
$rows = mysql_num_rows($result);
for ($j = 0 ; $j < $rows ; ++$j)
{
echo 'User ID: ' . mysql_result($result,$j,'uid') . '<br />';
echo 'Gender: ' . mysql_result($result,$j,'field_gender_value') . '<br />';
echo 'created: ' . mysql_result($result,$j,'created') . '<br />'. '<br />';
}
?>
Thank you

Help

