DHTML Kitchen
03-31-2004, 01:57 PM
I'm not getting the correct number of rows. I only ever get one row.
Here's the query.Queries are stored in an array.
if( is_array( $_POST['waterway'] ) ) {
foreach($_POST['waterway'] as $value) {
$queries[count($queries)] =
mysql_query("SELECT email FROM ehousebo WHERE waterway='$value'", $link);
}
}
Then I loop through the queries and count the rows for each:
for ($i = 0; $i < count($queries); $i++) {
for($j = 0; $j < count(mysql_num_rows($queries[$i])); $j++) {
$email_addresses[count($email_addresses)] = mysql_result($queries[$i], $j);
}
}
I only ever get one row for queries that should have multiple rows.
echo count(mysql_num_rows($queries[0]));
I should get 11 rows for some of my queries. I tested a query by replacing $value with 'Mississippi River' and still got only 1 row. But using the MySQL, monitor I get 11 rows:
mysql> select * from ehousebo where waterway="Mississippi River";
Why do I only get 1 row for mysql_num_rows?
Here's the query.Queries are stored in an array.
if( is_array( $_POST['waterway'] ) ) {
foreach($_POST['waterway'] as $value) {
$queries[count($queries)] =
mysql_query("SELECT email FROM ehousebo WHERE waterway='$value'", $link);
}
}
Then I loop through the queries and count the rows for each:
for ($i = 0; $i < count($queries); $i++) {
for($j = 0; $j < count(mysql_num_rows($queries[$i])); $j++) {
$email_addresses[count($email_addresses)] = mysql_result($queries[$i], $j);
}
}
I only ever get one row for queries that should have multiple rows.
echo count(mysql_num_rows($queries[0]));
I should get 11 rows for some of my queries. I tested a query by replacing $value with 'Mississippi River' and still got only 1 row. But using the MySQL, monitor I get 11 rows:
mysql> select * from ehousebo where waterway="Mississippi River";
Why do I only get 1 row for mysql_num_rows?