sqlnoob Posted March 11, 2009 Share Posted March 11, 2009 the script: $genresult = mysql_query("SELECT * FROM Persons WHERE GeneralID='$pickedgeneral'"); $genrow = mysql_fetch_assoc($genresult); $capfirst = $genrow['ForeName']; $capsecond = $genrow['HindName']; $yearling = $genrow['Birth']; $captain = "$capfirst.$capsecond"; mysql_query("UPDATE Generals SET Titles ='taisho' WHERE GeneralID ='$pickedgeneral'"); mysql_query("UPDATE Armies SET Taisho ='$pickedgeneral', Generalname ='$captain', Generalbirth ='$yearling' WHERE ArmyID ='$pickedarmy'"); echo "<BR>The general was assigned to the army <BR>Please remember that the general remains fixed to the army and this may not be changed"; the tables: mysql_select_db("shugonl", $con); $sqlgen = "CREATE TABLE Generals ( GeneralID int(7) NOT NULL AUTO_INCREMENT, PRIMARY KEY(GeneralID), Clan varchar(20) NOT NULL, ForeName varchar(6) NOT NULL, HindName varchar(6) NOT NULL, Birth int(4) DEFAULT '1999', Honor int(3) DEFAULT '1', Titles varchar(7) DEFAULT 'samurai' )"; mysql_query($sqlgen,$con); mysql_select_db("shugonl", $con); $sqlarme = "CREATE TABLE Armies ( ArmyID int(4) NOT NULL AUTO_INCREMENT, PRIMARY KEY(ArmyID), Armyclan varchar(20) NOT NULL, Armyname varchar(20) NOT NULL, Armyduty varchar(9) NOT NULL, Armylocation int(3) NOT NULL, Taisho int(7) DEFAULT '0', Generalname varchar(12) DEFAULT 'noname', Generalbirth int(4) DEFAULT '1999', Yarigumi int(6) DEFAULT '0', Nagayarigumi int(6) DEFAULT '0', Naginatagumi int(6) DEFAULT '0', Yumigumi int(6) DEFAULT '0', Teppogumi int(6) DEFAULT '0', Kengumi int(6) DEFAULT '0', Mushagumi int(6) DEFAULT '0', Kagemusha int(6) DEFAULT '0', Sohei int(6) DEFAULT '0', Yamabushi int(6) DEFAULT '0', Shugenja int(6) DEFAULT '0', Kenzei int(6) DEFAULT '0', Attackpoint int(1) DEFAULT '1' )"; mysql_query($sqlarme,$con); the problem: Obviously the script is faulty, because it is not updating the Armies table properly. I'm not entirely sure it is the concatenation that is wrong. Its probably something really stupid that i glanced through, but again it boggles me for hours now. example: if ForeName is Yoshi and HindName is sue then the captain variable should be Yoshisue Quote Link to comment https://forums.phpfreaks.com/topic/148938-concatenation-problem/ Share on other sites More sharing options...
Mchl Posted March 11, 2009 Share Posted March 11, 2009 I think you mean this line $captain = "$capfirst.$capsecond"; you probably want $captain = "$capfirst $capsecond"; Quote Link to comment https://forums.phpfreaks.com/topic/148938-concatenation-problem/#findComment-782041 Share on other sites More sharing options...
Thetcm Posted March 18, 2009 Share Posted March 18, 2009 or $captain = $capfirst.' '.$capsecond; if you want to keep the concatenation. Quote Link to comment https://forums.phpfreaks.com/topic/148938-concatenation-problem/#findComment-787683 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.