php - string or function? (multiple on single page)
Posted: Mon Oct 08, 2007 3:40 pm
I'm somewhat of a novice when it comes to strings and functions...and running into a bit of a wall.
The Situation:
I've got a simple query that I'm trying to echo over and over again within a single page (username if chosen or first and last name as else).
I've tried working with strings and functions to no avail when it comes to outputting them more than once. To save on the coding and size of the file, I'd love to do this function once and then just echo the function where is needed.
Here's my if/then statement that I'd like to make into a repeatable function:
Any help would be amazing!
The Situation:
I've got a simple query that I'm trying to echo over and over again within a single page (username if chosen or first and last name as else).
I've tried working with strings and functions to no avail when it comes to outputting them more than once. To save on the coding and size of the file, I'd love to do this function once and then just echo the function where is needed.
Here's my if/then statement that I'd like to make into a repeatable function:
Code: Select all
<?php
if($row_rsUserDetails['use_username'] == 1)
{
echo $row_rsUserDetails['Username'];
}
else
{
echo $row_rsUserDetails['f_name'];
echo " ";
echo $row_rsUserDetails['l_name'];
}
?>