returning multiple resultsets from mysql
| From: | Adam Duston | Date: | Tue, 30 Aug 2005 04:02:36 +0000 |
| Subject: | returning multiple resultsets from mysql | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20644@lists.php.net to get a copy of this message | ||
dear pear community,
i have a mysql (version 4) db (BikeDB) with a table called
"mapPointTypes", and i have the following php:
<html>
<body>
<?php
require_once 'XML/RPC.php';
require_once 'DB.php';
$db = DB::connect("mysql://biker:3dsmax7@localhost/BikeDB");
$db->setFetchMode(DB_FETCHMODE_ASSOC);
$q = $db->query("SELECT * FROM mapPointTypes WHERE id = 1");
$row = $q->fetchRow();
echo $row['displayName']; // outputs the display name
print '<br/>';
$q = $db->query("SELECT * FROM mapPointTypes WHERE id = 1; SELECT *
FROM mapPointTypes WHERE id = 2;");
echo $q->getMessage(); // outputs "DB Error: syntax error"
?>
</body>
</html>
i would expect the second query (returning two resultsets) to be
valid, but apparently it is not. Is there anyway to get the results of
multiple selects without multiple roundtrips to the database using
Pear DB with MySql?
i've been searching the internet for hours trying to find an answer to
this question, so any help would be appreciated. i'm also wondering
why more people don't use multiple resultsets -- it's quite common in
the ado.net world.
thank you very much for any help,
adam
--
aduston@uchicago.edu
312-375-9879