php mysqli stmt -


I'm new to php mysql. I am selecting the results from the database .. and I use the bicycle screen But I'm printing them ($ stmt-> fetch ()): .. I want to cycle through the results again after the first cycle without calling the database (the applefuck result set)

I am using php5, mysqli, stms on xmpp server

You can use arrays.

When you cycle through the results for the first time, then you can put values ​​in the array and later in the second cycle you can access the elements from the array.

> Something like this:

  $ query = "Select name from EMP"; $ Arr = array (); If ($ stmt = $ mysqli- & gt; Ready ($ query)) {$ stmt- & gt; carry about (); $ Stmt- & gt; Bind_result ($ name); // 1 cycle while ($ stmt-> fetch ()) {$ arr [] = $ name; // save in array} $ stmt-> Close (); // Second cycle foreign currency ($ arr as $ name) {// $ name again}}  

Comments