Selecting mutiple records problem.....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Last try: Why does this script

Code: Select all

for($i=0; $i<10; $i++) {
}

echo $i;
print 10 instead of 0 1 2 3 4 5 6 7 8 9?
Your script has the same problem.
User avatar
ghadacr
Forum Contributor
Posts: 135
Joined: Fri May 11, 2007 10:44 am

Post by ghadacr »

OH OK....now i get it, it looks like one of those homer times...DOH.........

One more thing can you just show me where to put the curly brackets because i keep on getting infintate loops, or outputs a indivdual form for each record... Thanks Volka....
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You currently have

Code: Select all

if(isset($_GET['HotelRoomID']))
{
	foreach($_GET['HotelRoomID'] as $k=>$k1)
	{
		mssql_query();
		mssql_num_rows();
	}
}

$i=0;
while ($i < $count) {
	mssql_fetch_array();
}
You probably want

Code: Select all

if(isset($_GET['HotelRoomID']) && is_array($_GET['HotelRoomID']) )
{
	foreach($_GET['HotelRoomID'] as $k=>$k1)
	{
		mssql_query();
		mssql_num_rows();
		
		$i=0;
		while ($i < $count) {
			mssql_fetch_array();
		}
	}
}
Post Reply