Jump to content

Inputting Two Variables in One field


dark dude

Recommended Posts

[quote]
$num = mysql_numrows($result);

$UpDateNum = $num + 1;

$query="INSERT INTO Planets VALUES ('','$Galaxy','$System','$Planet','$Continent','',[color=red][b]'Colony'[/b][/color],'$Username','0','500','10','250','100','Colony11','1','','','','','','','','','$ip',CURRENT_TIMESTAMP(NOW()))";
mysql_query($query);[/quote]

Focus on the bit in bold red...

I want to be able to make it something like:

'Colony(whatever $UpDateNum is)'

But I cant find how to do it. I've tried 'Colony'.$UpDateNum.'' but that doesnt work...

Please help? ???
Link to comment
Share on other sites

[quote author=AndyB link=topic=107538.msg431607#msg431607 date=1157896935]
Putting more than one value in a field is easy; it's getting them out separately that's the problem. Are you [b]absolutely certain[/b] that that's what you want to do?  One more field in your database table is pretty cheap.
[/quote]

Yeah, I just want the two variables to merge :P

Because my finding system finds "Colonies" by the number after it.

The "UpDateNum" variable holds the number that's to go after the name "Colony".

So, if there are already 4 colonies, UpDateNum will equal 5, and it will input into the database "Colony5"...
Link to comment
Share on other sites

[quote author=dark dude link=topic=107538.msg431620#msg431620 date=1157897885]
Yeah, I just want the two variables to merge :P

Because my finding system finds "Colonies" by the number after it.
[/quote]

There are no numbers in Colony5 or Colony23 - those are strings.
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.