Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PEAR DB executing multiple queries 1

Status
Not open for further replies.

xpblueScreenOfDeath

Programmer
Sep 1, 2004
87
Can I execute multiple queries with PEAR DB? But, I notice PEAR DB has a function called nextResult which is suppose to return the next resultset. When I try the follow, PEAR always give me an error about syntax. But when I take off the last part that return the id, it works fine. So, how do I execute multiple queries with PEAR?

Code:
$db->query("Insert Into item_format (Description) values (?); select last_insert_id();", array(2));
 
It depends. On some, you may not be able at all: the PEAR DB documentation on nextResult() contains "Some database backends supports executing more then one query at the same time". I infer from this that not all database backends do support this.

An examination of the PEAR DB code shows that, for example, with all MySQL versions, nextResult() is defined as:

Code:
    // {{{ nextResult()

    /**
     * Move the internal mysql result pointer to the next available result
     *
     * This method has not been implemented yet.
     *
     * @param a valid sql result resource
     *
     * @return false
     */
    function nextResult($result)
    {
        return false;
    }

    // }}}

which means the function does nothing.

What database backend are you using?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top