global $db;
	$tracks = "";
	$sql = "select description from movies where movieid=".$movieid." and mp3link IS NOT NULL";
	$db->query($sql);
		while ($db->next_record())
		{
			$tracks .= "<p>" . $db->f("description") . "</p>";
		}
		
	echo $tracks;

This is a code I'm using to get all records from a database with a certain ID number. I've tried the query in phpmyadmin and it shows me all the records, however, when I use this snippet of PHP code it always drops the first record it finds.

What am I doing wrong?

somewhere in your code you probably have a DB class (ex: $db = new DB(...);/* or something similar */ ). Does that class have a method that will let you know if any records were returned? It would help to see the definition of your custom class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.