1

I will receive from a back office a string like one#two#three#. I would like to know how could I store the one, two, three in different variables. The string can have multiple substrings so something like PHP explode would be perfect.

String= "one#two#three#";
sub1  = "one";
sub2  = "two";
sub3  = "three";
Matt
  • 1,115
  • 13
  • 29
  • 2
    Usually when you store things in a database you store them in tables and columns, not variables. It is possible to write database scripts that use variables, but I'm doubting that you actually mean that. Can you clarify? – Stephen Ostermiller Jun 30 '14 at 19:27
  • This is a procedure and some of the vars will have multiple infos inside a string, the ideia is to split theose strings and make the inserts updates etc using the info you have on the substrings. – user3791457 Jun 30 '14 at 19:51
  • I have edited your title question based on this information. – Stephen Ostermiller Jun 30 '14 at 19:55

1 Answers1

0

Though this question is a duplicate of this question, what you're looking for is here

I'd reccomend, for simplicity, that you just use PHP to split the string up before trying to put it in the database. The idea is "to split those strings and make the inserts updates etc using the info you have on the substrings" -- that is much easier done in PHP before throwing it into the database, than it is trying to do the whole thing with stored procedures.

Community
  • 1
  • 1
J-Dizzle
  • 3,176
  • 6
  • 31
  • 49