Page 1 of 1

Problem With Returned Record Set

Posted: Sun Jun 17, 2007 10:44 pm
by dgny06
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Thank you in advance for any help....

I am having a problem returning a basic record set on a page. The problem is that my code is returning a new table for every record in my query. Now I know that I have the table tag inside of the echo command but I can not figure out how to tweak it to be one table. Thanks again.

Code: Select all

<?PHP

			  	$ViewAllAddresses = 'SELECT * FROM  tbPerson';
   				$ReturnedAddresses = mysql_query($ViewAllAddresses);
 
 	    			while($Record = mysql_fetch_assoc($ReturnedAddresses))
					{
					
					$fname = $Record["FirstName"]; 
					$lname = $Record["LastName"]; 
					$addr1 = $Record["Address1"]; 
					$addr2 = $Record["Address2"]; 
					$city = $Record["City"]; 
					$state = $Record["State"]; 
					$zip = $Record["Zip"]; 
					$hphone = $Record["HomePhone"]; 
					$bphone = $Record["BusinessPhone"]; 
					$cphone = $Record["CellPhone"]; 
					$email = $Record["Email"]; 
    
	
    				echo "
					<table align="center" border="1"><tr>
					<td>$fname</td>
					<td>$lname</td>
					<td>$addr1</td>
					<td>$addr2</td>
					<td>$city</td>
					<td>$state</td>
					<td>$zip</td>
					<td>$hphone</td>
					<td>$bphone</td>
					<td>$cphone</td>
					<td>$email</td>
					</tr></table>";

					}
				
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Sun Jun 17, 2007 10:53 pm
by feyd
Move the table tags to separate echoes before and after the loop.

Posted: Sun Jun 17, 2007 10:59 pm
by dgny06
that worked....thank you so much