update page now

Voting

The Note You're Voting On

timchampion dot NOSPAM at gmail dot com
14 years ago
Just wanted to make sure that all were aware of get_result.

In the code sample, after execute(), perform a get_result() like this:

<?php

// ... document's example code:

    /* bind parameters for markers */
    $stmt->bind_param("s", $city);

    /* execute query */
    $stmt->execute();

    /* instead of bind_result: */
    $result = $stmt->get_result();

    /* now you can fetch the results into an array - NICE */
    while ($myrow = $result->fetch_assoc()) {

        // use your $myrow array as you would with any other fetch
        printf("%s is in district %s\n", $city, $myrow['district']);

    }
?>

This is much nicer when you have a dozen or more fields coming back from your query.  Hope this helps.

<< Back to user notes page

To Top