Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_result( $Statement) {
- $RESULT = array();
- $Statement->store_result(); *Line 5* <--
- for ( $i = 0; $i < $Statement->num_rows; $i++ ) {
- $Metadata = $Statement->result_metadata();
- $PARAMS = array();
- while ( $Field = $Metadata->fetch_field() ) {
- $PARAMS[] = &$RESULT[ $i ][ $Field->name ];
- }
- call_user_func_array( array( $Statement, 'bind_result' ), $PARAMS );
- $Statement->fetch();
- }
- return $RESULT;
- }
- $link = new mysqli("localhost","user","123","database");
- // Check connection
- if($link === false){
- die("ERROR: Could not connect. " . mysqli_connect_error());
- }
- $sql = "SELECT * FROM job_book";
- $query = $link->prepare($sql);
- $query->execute();
- $RESULT = get_result($query);
- print_r( $RESULT );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement