mysqli_fetch stmt->fetch Fetch results from a prepared statement into the bound variables Description Procedural style: mixedmysqli_fetch objectstmt Object oriented style (method): stmt mixed fetch void mysqli_fetch returns row data using the variables bound by mysqli_bind_result. Note that all columns must be bound by the application before calling mysqli_fetch. Return values Return values Value Description &true; Success. Data has been fetched &false; Error occured &null; No more rows/data exists
See also mysqli_prepare, mysqli_stmt_errno, mysqli_stmt_error, mysqli_bind_result Example Object oriented style query( "DROP TABLE IF EXISTS friends"); $mysqli->query( "CREATE TABLE friends (id int, name varchar(20))"); $mysqli->query( "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $stmt = $mysqli->prepare( "SELECT id, name FROM friends"); /* execute statement */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($column1, $column2); /* fetch result */ while ($stmt->fetch()) { printf("Id: %d Name: %s\n", $column1, $column2); } $stmt->close(); $mysqli->close(); ?> ]]> Procedural style ]]>