On Sat, February 3, 2007 9:09 pm, Albert Padley wrote: > It's late and I've been at this a long time today so I throw myself > on the mercy of the list. > > I have an echo statement that I use in conjunction with a MySQL query. > > echo "<tr>\n<td class=\"tabletext\">" . $row['time'] . "</td>\n<td > class=\"tabletext\">" . $row['field'] . "</td>\n<td class=\"tabletext > \">" . $row['division'] . "</td>\n"; > > This works perfectly fine. However, I will be using the same code > numerous times on the page and wanted to stuff it all into a > variable. At this point I can't remember the proper syntax and > quoting to get this right. Any takers? If you just want all that in a variable, you can do: $variable = "<tr>\n..."; Presumably, however, when you use that same thing again, you want the variables to be substituted in with their current values. AFAIK, there's no good/easy way to do that, except for using 'eval' -- And you almost for sure don't want to do that for something this simple. You could, however, quickly write a "print_row" function that you could call from anywhere in the script, and that would probably be the best solution. The fact that you need to use this same bit over and over in your page makes me wonder if you aren't doing something fundamentally wrong in the first place... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php