mikebyrne Posted December 9, 2009 Share Posted December 9, 2009 I currently have a database of names and addresses which looks like this: ,1,Caxxan,Cathy,Wxxxde,Ardreigh,Axy,Co.xxxe ,2,Caxxan,Liam,Wxxxde,Ardreigh,Axy,Co.xxxe ,3,Caxxan,Margaret,Wxxxde,Ardreigh,Axy,Co.xxxe I want to run a piece of php that will insert "The $Sname Family" in a new column where $Sname is the varible of the surname of that row. Any idea how I can code this?? Link to comment https://forums.phpfreaks.com/topic/184522-inserting-variable-into-new-column/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 9, 2009 Share Posted December 9, 2009 Assuming mysql, execute this query (substituting your actual column names) to update your new column with the concatenation of - 'The ', your Sname column values, and ' Family' - UPDATE your_table SET your_new_column = CONCAT('The ', Sname, ' Family') Link to comment https://forums.phpfreaks.com/topic/184522-inserting-variable-into-new-column/#findComment-974111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.