echoing records need some help

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

Post Reply
mohson
Forum Contributor
Posts: 372
Joined: Thu Dec 02, 2004 6:58 am
Location: London

echoing records need some help

Post by mohson »

Guys I need to put each of my table coloumns into this eco statement but it wont work as the records will appear with quotes around them and if i mess around with it too much then it wont work at all - how would i put in the following coloumns into this statement: salutation, firstname, surname, organisation? please help im stuck. thank you.

Code: Select all

while ($row = mysql_fetch_object($sql)) {

echo "$count. "$row->salutation">$row->firstname<br />\r\n"; // this is example, you may enter here anything you like
$count += 1;
}
?>
Bennettman
Forum Contributor
Posts: 130
Joined: Sat Jun 15, 2002 3:58 pm

Post by Bennettman »

Close the string before putting in each call to an object:

Code: Select all

echo $count . '. "' . $row->salutation . '">' . $row->firstname . '<br />' . "\r\n";
etc.
mohson
Forum Contributor
Posts: 372
Joined: Thu Dec 02, 2004 6:58 am
Location: London

Post by mohson »

Code: Select all

echo $count . '. ' . $row->salutation . '' . $row->firstname . '<br />' . "\r\n";
I done what u suggested but took out the extra quote marks because salutation was still appearing with quote marks but now each data item is appearing right next to each other e.g MrAndy what should I do
?>
mohson
Forum Contributor
Posts: 372
Joined: Thu Dec 02, 2004 6:58 am
Location: London

Post by mohson »

NO worries PROBLEM SOLVED cheers
Post Reply