Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Stand Alone OS · Dec 30, 2014 at 06:28 AM · c#mysqlphp

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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

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"; 

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Stand Alone OS · Dec 30, 2014 at 05:20 PM 0
Share

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";

avatar image jmgek · Dec 30, 2014 at 07:28 PM 0
Share

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

avatar image Stand Alone OS · Dec 30, 2014 at 07:51 PM 0
Share

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

avatar image jmgek · Dec 30, 2014 at 08:12 PM 0
Share

Got you your 15 karma :) have a good one man.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges