[TriLUG] new PHP question - what's up with join()?
Joseph Tate
dragonstrider at gmail.com
Tue Jan 25 10:40:22 EST 2005
join usually works with an array. I'd try $fullName = join (' ',
array($firstName, $lastname));
Please note that unlike perl, you have to explicitly create an array in PHP.
On Tue, 25 Jan 2005 10:35:48 -0500, Greg Brown <gregbrown at mindspring.com> wrote:
> PHP documentation shows there is a join() function that should, at
> least in appearance work a lot like Perl's join. So, I have two
> variables I want to join $firstName and $lastName. The following
> appears like it should work:
>
> $fullName=join(' ',$firstName,$lastName);
> echo "$fullName<br>";
>
> $fullName does not appear to be populated, or at least it will not
> print. The reason I want to join the variable is I have to have a full
> name in a database field such as:
>
> $query="insert into address (firstName,fullName)
> values('$firstName','$fullName')";
>
> Is there a better way to do this other then using join?
>
> Greg
>
> --
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
>
--
Joseph Tate
Personal e-mail: jtate AT dragonstrider DOT com
Web: http://www.dragonstrider.com
More information about the TriLUG
mailing list