How does PHP assign column values of database tables to arrays? $ Myquery @ mysql_query (& quot; select * fromdb_select & quot;) ordie (& quot; query statement execution failed! & Quot;); $ cntmysql_num_rows ($ myquery); for ($ i0; $ I & lt; $ cnt; $ I ++) {echo & quot; & qu PHP: how does one assign the column value of a database table to an array?
$ Myquery = @ mysql_query ("select * from db_select ")
Or die ("query statement execution failed! ");
$ Cnt = mysql_num_rows ($ myquery );
For ($ I = 0; $ I <$ cnt; $ I ++ ){
Echo "". mysql_result ($ myquery, $ I, 0 )."";
}
Currently, all values in column 0 of the database are saved in mysql_result. how can I assign the values in mysql_result to an array $ arr?
In addition, I think the form of mysql_result ($ myquery, $ I, 0) is too troublesome. can I start with the query statement directly,
$ Myquery = @ mysql_query ("select the columns I need from db_select"), and then simplify mysql_result ($ myquery, $ I, 0) to mysql_result ($ myquery, $ I )?
New to PHP, I hope experts can answer this question.
------ Solution --------------------
Mysql_fetch_array
------ Solution --------------------
While ($ row = mysql_fetch_array ($ result )){
$ Newarray = $ row
}