Jump to content

concatenation problem


sqlnoob

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.