diff --git a/adminarea_useradmin.php b/adminarea_useradmin.php index 7de3071..c2a4a6d 100644 --- a/adminarea_useradmin.php +++ b/adminarea_useradmin.php @@ -28,46 +28,36 @@ if($_SESSION['isadmin'] == 0) { } echo ''; -?> -query("SELECT * FROM table LIMIT 10"); -//test if connection failed -if(mysqli_connect_errno()){ - die("connection failed: " - . mysqli_connect_error() - . " (" . mysqli_connect_errno() - . ")"); +// Get the result in to a more usable format. +$query = array(); +while($query[] = mysqli_fetch_assoc($result)); +array_pop($query); + +// Output a dynamic table of the results with column headings. +echo ''; +echo ''; +foreach($query[0] as $key => $value) { + echo ''; } - -//get results from database -$result = mysqli_query($connection,"SELECT * FROM users"); -$all_property = array(); //declare an array for saving property - -//showing property -echo '
'; + echo $key; + echo '
- '; //initialize table tag -while ($property = mysqli_fetch_field($result)) { - echo ''; //get field name for header - array_push($all_property, $property->name); //save those to array -} -echo ''; //end tr tag - -//showing all data -while ($row = mysqli_fetch_array($result)) { - echo ""; - foreach ($all_property as $item) { - echo ''; //get items using property value +echo ''; +foreach($query as $row) { + echo ''; + foreach($row as $column) { + echo ''; } echo ''; } -echo "
' . $property->name . '
' . $row[$item] . '
'; + echo $column; + echo '
"; -?> -'; + echo '

'; echo ''; ?>