- Home /
Add multiple mySQL items at once?
Hello everyone,
Sorry if this question seems foolish as im just teaching myself c# and php for fun, Any how... I have php script set up to echo each server in my mySQL database followed by a ',' so i end up with:
"test server1, test server2, test server3,"
would it be possible to add each of these individually to a list of strings?
I already know how to receive info from php i just can't seem to think of a way to split these up? My only idea was to check if the string contains a "," then somehow split?
Thanks to anyone who took the time to try and understand my question :p
Answer by jmgek · Dec 30, 2014 at 07:50 AM
Well this is not a PHP forum but I think you are asking about 'concatenation' string concatenation is the operation of joining character strings end-to-end.
in c# it is
string myCString = "This is a String " + " This is the other string";
in PHP it is
string myPHPString = "This is a string " . " This is the other string";
Thanks for your answer, however im looking for quite the opposite.
Imagine I have a string:
String1 = "Test1 Test2 Test3";
$$anonymous$$y question is: Is it possible to split these into multiple strings like:
String 1 = "Test1";
String2 = "Test2";
String3 = "Test3";
Why are you getting back a string of three servers? just echo out
echo $server1;
echo $server2;
echo $server3;
But for whatever reason you cant just use substr
<?php
$rest = substr("abcdef", -1); // returns "f"
$rest = substr("abcdef", -2); // returns "ef"
$rest = substr("abcdef", -3, 1); // returns "d"
$server = substr($serverString, x, y); // returns whatever
?>
Remeber to vote answer up if that worked for you
I would vote up as your assistance is very appreciated. However... I need 15 rep :(
Im young and like i said im $$anonymous$$ching myself php and c# so I might not be doing it the right way...
I have php echoing out every server in my database at once, I then want to add each of these servers to a string list in c# so that I can create a server list in unity for players to choose from.
So right now I have a string "Server1, Server2, Server3" but i want to somehow split these up and add them to my string list individually. Hopefully this makes sense... If not... Thanks for attempting to help :D
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
I need to update a int in a specific row on mysql server. 0 Answers
Call single function in php from c#? 1 Answer
Remember currently logged in player 1 Answer