Jump to content

help with loop


MDanz

Recommended Posts

I want to loop the below code until $grade=80, is the code below correct

 

<?php 


include "grade.php"; 

	$getgrade = new Grade(); // create an instance of the class(Grade)
echo "<ul id='navigation'>";
for($grade=0;$grade<80;$grade+10){

$max = $grade+9; //get max grade for that grading bracket, e.g. 10-19%

echo "<li><a href='#'>$grade-$max%</a>
	<ul><li>";
	$getgrade->results($grade+9); // call the method(results) in grade.php
	echo "</li></ul>
</li>";

}
echo "</ul>";


?>

 

the page isn't loading when i try it so i'm guessing i got it wrong..

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/223633-help-with-loop/
Share on other sites

That for loop will run 7 times I think.. You are incrementing the counter by 10 each time..

 

What do you mean the page isn't loading? Have you got error reporting turned on for your php?

 

If you're using an online host, and can't edit the php.ini file, then you need to explicitly turn on error reporting. See here:

http://php.net/manual/en/function.error-reporting.php

 

Hope that helps.

 

Denno

Link to comment
https://forums.phpfreaks.com/topic/223633-help-with-loop/#findComment-1156007
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.