Jump to content

Recommended Posts

Posted

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

Posted

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;

Posted

Tried both, like the one below. No errors, but still reading username.

 

if ($firstname != "") {

$mainNameLine = $username . ' ' . $maidenname . ' ' . $lastname;

$username = $firstname;

} else {

$mainNameLine = $username;

}

Posted

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

Posted

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,

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...