The following query:
$getiplist = mysql_query($questions, $link)or die(mysql_error());
$numofips = mysql_num_rows($getiplist);
Gaves me a result of 21.
If I echo the results:
while($row = mysql_fetch_array($getiplist))
{
foreach($row as $column)
echo $row['e_mail_rest']."<br>";}
I get 42 results, each result is being duplicated so I get each twice.
I'm trying to see where am I stumbling but I do not get it.
Where's the stupid mistake?
Duplicated results
Moderator: General Moderators
RTFM
The optional second argument result_type in mysql_fetch_array() is a constant and can take the following values: MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH. This feature was added in PHP 3.0.7. MYSQL_BOTH is the default for this argument.
By using MYSQL_BOTH, you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).
The optional second argument result_type in mysql_fetch_array() is a constant and can take the following values: MYSQL_ASSOC, MYSQL_NUM, and MYSQL_BOTH. This feature was added in PHP 3.0.7. MYSQL_BOTH is the default for this argument.
By using MYSQL_BOTH, you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact: