dark dude Posted September 10, 2006 Share Posted September 10, 2006 [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? ??? Quote Link to comment Share on other sites More sharing options...
hostfreak Posted September 10, 2006 Share Posted September 10, 2006 You would have to do this:[code]$query = "INSERT INTO Planets(field, field, Colony) VALUES('$field','$field','$Colony$UpDateNum')";[/code] Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 10, 2006 Share Posted September 10, 2006 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 Link to comment Share on other sites More sharing options...
hostfreak Posted September 10, 2006 Share Posted September 10, 2006 If you must have them in one field, you may want to consider separating them by something. Then when you retrieve the data you can explode it. That would make things easier. Quote Link to comment Share on other sites More sharing options...
dark dude Posted September 10, 2006 Author Share Posted September 10, 2006 [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 :PBecause 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 Link to comment Share on other sites More sharing options...
AndyB Posted September 10, 2006 Share Posted September 10, 2006 [quote author=dark dude link=topic=107538.msg431620#msg431620 date=1157897885]Yeah, I just want the two variables to merge :PBecause my finding system finds "Colonies" by the number after it.[/quote]There are no numbers in Colony5 or Colony23 - those are strings. Quote Link to comment 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.