I'm still new to MySQL/PHP. The book I've ordered hasen't arrived yet, and I am eager to learn. :P
Now, here's the problem:
Is it possible to have multilpe queries on one mysqli object?
I found some code, and tried amending it, but it doesn't work.
I get Fatal error: Call to a member function query() on a non-object in /home/.mohave/tetest/<mysite>/ex/table2b.php on line 35
which leads me to believe that the "object" somehow closes connection with the db after one query.
Also, with my setup I cannot use $result.close() to "release" the connection.
Code:$connect = new mysqli("....") $query = "SELECT * ..." $result = $connect->query($query) function f1() { $query_a = "SELECT.." $results_a = $connect->query($query_a) <-- line 35 ..do something... } function f2() { $query_b = "SELECT.." $results_b = $connect->query($query_b) ..do something... } while($row = $result->fetch_array(MYSQLI_ASSOC)) { f1(some parameter from $row) f2(another parameter from $row) ...do something more... }



Reply With Quote

Bookmarks