PHP MySQL Database - All rows into Multi-Dimensional Array -



PHP MySQL Database - All rows into Multi-Dimensional Array -

it's been long while since touched php so, need refresher of sorts.

i have html form captures several lines of info (dataa, datab, datac & datad) , inserts them database table (dataall). entering rows upon rows of info "dataall". i'm looking create display.php page, code take of info , place each cell array, or row of array, example:

new array = [["dataa", "dataa", "dataa", "dataa", "dataa"], ["datab", "datab", "datab", "datab", "datab"], ["datac", "datac", "datac", "datac", "datac"], ["datad", "datad", "datad", "datad", "datad"]];

but cannot remember syntax on how perform task. help appreciated.

the database named 'compdata', table 'dataall', , each row 'dataa', 'datab', 'datac', 'datad'.

please allow me know if need supply more information.

since asked rows, simple code query written below:

<?php //after connection mysql db using mysql_connect() $sql = "select dataa, datab, datac, datad `compdata`.`dataall`" ; $result = mysql_query($sql) ; if(mysql_num_rows($result) > 0 ){ while($row = mysql_fetch_array($result)){ $dataarray[] = $row ; } } echo '<pre>'; print_r($dataarray) ;//you got desired 2d array results ?>

php mysql sql arrays

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -