Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.