Hamish Posted April 16, 2007 Share Posted April 16, 2007 Hi All, Newbie first post just starting to learn PHP and MyQL I have been trying to get my head round the following and hope you can help. Below is a line from the result of a query which I would like to print to screen in a table, the line in question should display i.e.<br> “Mr Peter Williams” spacing the record at present it prints MrPeterWilliams. What is the correct syntax to use to space out the name correctly? echo(“<td>” . $rec[“PLTitle”] . $rec[“PLFirstName”] . $rec[“PLSName”] . “</td>”); Regards Hamish Link to comment https://forums.phpfreaks.com/topic/47271-solved-spacing-record-set/ Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 echo("<td>" . $rec["PLTitle"] . " " . $rec["PLFirstName"] . " " . $rec["PLSName"] . "</td>"); that should work, just adding . " " . between each statement Link to comment https://forums.phpfreaks.com/topic/47271-solved-spacing-record-set/#findComment-230571 Share on other sites More sharing options...
boo_lolly Posted April 16, 2007 Share Posted April 16, 2007 you can also do: echo "{$rec['PLTitle']} {$rec['PLFirstName']} {$rec['PLSName']}"; Link to comment https://forums.phpfreaks.com/topic/47271-solved-spacing-record-set/#findComment-230598 Share on other sites More sharing options...
Hamish Posted April 16, 2007 Author Share Posted April 16, 2007 Thanks both for the very prompt reply and solution. Easy when you know how. Difficult to find when you don't know what you're looking for! On a similar theme. How would the same output echo("<td>" . $rec["PLTitle"] . " " . $rec["PLFirstName"] . " " . $rec["PLSName"] . "</td>"); be printed out on seperate lines ie Mr Peter Williams Thanks Again Hamish Link to comment https://forums.phpfreaks.com/topic/47271-solved-spacing-record-set/#findComment-230624 Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 replace the " " with "<br />" the "" just outputs html.. so you can put any html between them, even tables etc.. Link to comment https://forums.phpfreaks.com/topic/47271-solved-spacing-record-set/#findComment-230640 Share on other sites More sharing options...
Hamish Posted April 16, 2007 Author Share Posted April 16, 2007 Thank you very much Just the job. Regards Hamish Link to comment https://forums.phpfreaks.com/topic/47271-solved-spacing-record-set/#findComment-230674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.