Hi,
I have a script where I print some texts collected by users and logged into a MySQL table, the user information is just a user_number code (1,2,3...) that references another table, with their email addresses. So what I do is get user_number and user_email from the second table and array it:
<?
$users = mysql_query("select user_number,user_email from auth_user");
while ($column = mysql_fetch_array($users)) $user[] = $column['user_email'];
?>
Later on, i try to print the email address using the array with the user_number as index:
<td> <center> <? echo $user[$collector-1] ?> </td>
$collector is the variable where I stored the user_number code from the first table. The "-1" is obviously there because the first element of $user is indexed as 0.
for some bizarre reason I get it right for some entries, but for some others it displays the email address corresponding to the PREVIOUS user in sorted order. Can anye explain me this ?
Is there some way to use mysql_fetch_array starting by index [1] ?
Is there some more efficient way to make all this ?
I guess it all comes down to handling foreign keys in MySQL via PHP... could anyone help me ?
infinite thanks.
Miguel