$stmt = $mysqli->prepare ("SELECT * from Country ORDER by Name LIMIT 5")) {
$stmt->execute ();
/* BIND variables to prepared statement */
$stmt->bind_result ($col 1, $col 2);
How can I bind Bind_result () to all the columns, if I don't know how many fields there are in *.
My purpose is to achieve:
1. SELECT * ... Query
2. Return all results to an array of all records;
From the Internet to find a variety of information has not been concluded.
Reply to discussion (solution)
SHOW fields from table name;
DESC table name;
Upstairs with me asked the question bull head not ponytail
Since there are so many fields, it is impossible to know how many variables are bound
So what's the point of binding all the columns?
$stmt = $mysqli->prepare ("SELECT * from Country ORDER by Name ASC");
SHOW fields from table name;
And then loop the bindings, okay?
SHOW fields from table name;
DESC table name; $stmt->bind_result ($col 1, $col 2);