I apologize in advance if this question has been posted and answered multiple times. I am new to this site.
My question- I have made a form with First Name, Last Name and many others I want to have both the First Name and Last Name post into their respective columns in the database but I would also like to combine the two and have it entered into a column in the DB titled FULL NAME with the format of Last Name, First Name. Is there a way to do this?
By the way I have the everything working so far except I would like to add the feature (I am asking about above) of adding to the FULL NAME in the database.
before you do your insert query just set the fullname var and use that to insert the desired data into your db
e.g.
<cfset theFullName=form.FirstName & " " & form.LastName> or <cfset theFullName="#form.FirstName# #form.LastName#"> (they are the same thing)
hth ~megan
------------------------------------------------------- "The chief cause of failure & unhappiness is trading what you want most for what you want now." ~Zig Ziglar
quote: I would also like to combine the two and have it entered into a column in the DB titled FULL NAME
Any specific reason? Typically it is best to avoid storing calculated values because it is easy for them to get out of synch. Just concatenate the values in sql. The concatenation operator depends on your database, but in MS SQL something like
SELECT FirstName +' '+ LastName AS FullName FROM TableName WHERE ...