This question already has an answer here:
- php array from mysql 2 answers
I coded a simple function to loop trough and display all variables in the sql table. However foreach $row displays the rows two times, 1 time as a row name and 1 time as a row number.
1 : $row['NAME'] Name form
2 : $row[0]' Number form
PHP :
<?php
include "condetails.php";
$query = "select * from pagedetails";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
foreach($row as $var => $val) {
echo "VARNAAM :".$var;
echo "<br />";
echo "VALUE".$val;
echo "<br />";
echo "<br />";
}
}
?>
OUTPUT :
VARNAAM :0 VALUE1
VARNAAM :id VALUE1
VARNAAM :1 VALUEdddd
VARNAAM :h1txt VALUEdddd
</div>