I am trying to join 2 MySQL tables, but I can't manage to help myself using the examples online.
The table dat_eb_field_values
countains 3 rows: registrant_id, field_id and field_value.
My second table: dat_eb_registrants
contains normal rows such as user_id, first_name, last_name ect.
I am trying to get those 2 tables together so that the row: field_value can be used just like the other values from dat_eb_registrants
.
Currently I am using the following method, but since the query's are not connected, I can't sort the output on field_value from the table dat_eb_field_values
.
$result = mysql_query("SELECT user_id,first_name,last_name,email FROM `dat_eb_registrants`")
while ($row = mysql_fetch_row($result)) {
$result1 = mysql_query("SELECT field_value FROM field_values WHERE (field_id = 53) AND (user_id = $row[0])"); $r1 = mysql_fetch_row($result1); echo $r1[0];
echo $row[2];
$result2 = mysql_query("SELECT field_value FROM dat_eb_field_values WHERE (field_id = 54) AND (user_id = $row[0])"); $r2 = mysql_fetch_row($result2); echo $r2[0];
}
end so on....