Jump to content
Killersites Forums

Displays username, but not maiden or last name.


Recommended Posts

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

Link to post
Share on other sites

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;

Link to post
Share on other sites

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

Link to post
Share on other sites

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,

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...