Learning nested foreach loops
See comments in code.
This commit is contained in:
14
index.php
14
index.php
@ -95,9 +95,19 @@ switch ($mode) {
|
|||||||
$query->execute() or die('Could not execute query:<br>'.mysqli_error($db));
|
$query->execute() or die('Could not execute query:<br>'.mysqli_error($db));
|
||||||
$query->close();
|
$query->close();
|
||||||
|
|
||||||
//Debugging I think?
|
|
||||||
|
//Loop through $results better
|
||||||
|
//This is not done yet, but shows an example of a loop you could put a query statement in.
|
||||||
|
foreach ($_SESSION['results'] as $name => $value) {
|
||||||
|
foreach ($value as $n2 => $v2) {
|
||||||
|
echo $name.$n2.$v2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Debugging I think?
|
||||||
$variables['debug'] = $_SESSION['results'];
|
$variables['debug'] = $_SESSION['results'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'results':
|
case 'results':
|
||||||
|
Reference in New Issue
Block a user