Martin Norland wrote:
ioannes wrote:
My first attempt was to use $result=array_merge($result1,$result2) -
doesn't work. 'not a valid resource'
I have two databases with different connections, so MySQL UNION query
would not work.
How do I merge the result set of the queries in that case?
You're going to have to merge the results within PHP.
"not a valid resource" is an error you get when you try to read from a
result set and what you pass it isn't a resource for a result set.
I think you're doing something along the lines of:
$result1 = query_database_one($somequery);
$result2 = query_database_two($someotherquery);
$result = array_merge($result1, $result2);
while (mysql_fetch_row($result)) {
while reading I thought, would this:
while (($row = mysql_fetch_row($result)) || ($row = mysql_fetch_row($result2)))
{
// just do it. â
}
.. work (due to shortcircuiting)? and how ugly is it?
// foo
}
...
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php