It would seem the only way this could happen is if $last_name evaluates to 
true. Two suggestions:

1) Make some extra change in one of the printf statements so you can see 
which one is really being called.

2) If that doesn't illuminate anything, show a little more code.


On Sat, 11 May 2002, Jason Soza wrote:
> Argh!
> I hate it when one little annoying thing starts up right when I think I have
> the coding finished! I have the following code:
> if($last_name) {
>       printf("%s
> %s's<br><b>%s</b><br>%s\n</td>",$first_name,$last_name,$year,$color);
>       } else {
>       printf("%s's<br><b>%s</b><br>%s\n</td>",$first_name,$year,$color);
>       }
> So if the person has a last name in the database, print "John Doe's 1990
> Red" and if they don't, print "John's 1990 Red".
> This is in a while() statement, and it works except that on one particular
> query, the last record that comes up has a NULL value for the last name, but
> rather than printing $first_name's it prints $first_name $last_name using
> the last name of the previous record!
> Am I missing something there? Do I need to clear out a variable somewhere?
> It seems like since $last_name isn't even called in the else statement, it
> shouldn't even be showing up!
> Jason Soza

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to