Scotty13 Posted May 6, 2012 Report Share Posted May 6, 2012 This just displays the username aka first name. I want it to also display the member’s last name and maiden name if they have one. /////// Mechanism to Display Real Name Next to Username - real name(username) ////////////////////////// if ($firstname != "") { $mainNameLine = "$firstname $maidenname $lastname ($username)"; $username = $firstname; } else { $mainNameLine = $username; $maidenname; $lastname; } I want to display maiden and last name along with the user name. I've tried everything I could think of. Any suggestions? Thanks, Scott Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 6, 2012 Report Share Posted May 6, 2012 I'm not sure if this exactly answers your question, but it should help... $mainNameLine = "$firstname $maidenname $lastname ($username)"; This line works the way it does because the double quotes indicate a string. PHP understands that because double quotes are used, it is supposed to look inside the string for any variables you have used, and replace those variable names with the correct values. However, this line $mainNameLine = $username; $maidenname; $lastname; won't work because it is lacking those quotes. You've just strung along several variable names, and the ";" at the end indicates a end of line, so what you are actually writing is this: $mainNameLine = $username; $maidenname; $lastname; Instead, that line should be written as $mainNameLine = "$username $maidenname $lastname"; or $mainNameLine = $username . ' ' . $maidenname . ' ' . $lastname; Quote Link to comment Share on other sites More sharing options...
Scotty13 Posted May 6, 2012 Author Report Share Posted May 6, 2012 Tried both, like the one below. No errors, but still reading username. if ($firstname != "") { $mainNameLine = $username . ' ' . $maidenname . ' ' . $lastname; $username = $firstname; } else { $mainNameLine = $username; } Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 6, 2012 Report Share Posted May 6, 2012 My guess is that you have another error in your code then -- either a logic error, or perhaps $firstname is empty, or $maidenname and $lastname are empty. Quote Link to comment Share on other sites More sharing options...
Scotty13 Posted May 6, 2012 Author Report Share Posted May 6, 2012 It maybe the myMembers_table.php I get this error when I test it... Success in database CONNECTION..... no TABLE created. You have problems in the system already, backtrack and debug! <?php require_once "connect_to_mysql.php"; print "Success in database CONNECTION.....<br />"; $result = "CREATE TABLE myMembers ( id int(11) NOT NULL auto_increment, username varchar(255) NOT NULL, firstname varchar(255) NOT NULL lastname varchar(255) NOT NULL, maidenname varchar(255) NULL, ) "; if (mysql_query($result)){ print "Success in TABLE creation!...... <br /><br /><b>That completes the table setup, now delete the file <br /> named 'create_Table.php' and you are ready to move on. Let us go!</b>"; } else { print "no TABLE created. You have problems in the system already, backtrack and debug!"; } exit(); ?> Thanks, Scott Quote Link to comment Share on other sites More sharing options...
falkencreative Posted May 7, 2012 Report Share Posted May 7, 2012 That's due to an error in the MySQL syntax: $result = "CREATE TABLE myMembers ( id int(11) NOT NULL auto_increment, username varchar(255) NOT NULL, firstname varchar(255) NOT NULL lastname varchar(255) NOT NULL, maidenname varchar(255) NULL, ) "; I'm pretty sure you don't need that final comma in this line: maidenname varchar(255) NULL, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.