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
https://forums.phpfreaks.com/topic/20291-inputting-two-variables-in-one-field/
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"...
[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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.