Is it possible to use mysqli_fetch_object with a prepared statement

juDGEY

New Member
All the examples I see using mysqli_fetch_object use \[code\]mysql_query()\[/code\], I cannot get it to work with prepared statements. Does anyone know what is wrong with this code snippet, as fetch_object returns null.\[code\]$sql = "select 1 from dual";printf("preparing %s\n", $sql);$stmt = $link->prepare($sql);printf("prepare statement %s\n", is_null($stmt) ? "is null" : "created");$rc = $stmt->execute();printf("num rows is %d\n", $stmt->num_rows);$result = $stmt->result_metadata();printf("result_metadata %s\n", is_null($result) ? "is null" : "exists");$rc = $result->fetch_object();printf("fetch object returns %s\n", is_null($rc) ? "NULL" : $rc);$stmt->close();\[/code\]The output is:\[code\]preparing select 1 from dualprepare statement creatednum rows is 0result_metadata existsfetch object returns NULL\[/code\]
 
Top