About mysql and looping through columns

This code works. It’s in a class.

public function everything() {

		$sql = "SELECT * FROM subjects";
		$result = $this->query($sql, $this->connection);
		
		
			while ($lines = $this->fetch($result) ) {
					print_r ($lines['menu_name'] . "<br />");
			}
}

While i was doing this, i noticed that using ECHO will output me 5.

Just out of learning interest to php, i tried to change while loop so that it would do the loop while results are not over 5 or less than 5. Can’t get it to work that way. i Tried “$x++;” and just can’t get it to work.

Sites goes to error state. loads long. Maybe infinite loop.

Some help would be appreciated. thanks.

Need to change that print_r to echo or print.

Sponsor our Newsletter | Privacy Policy | Terms of Service