For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > March 2008 > explode string sql









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author explode string sql
janek

2008-03-27, 7:17 pm

Hello all,

I have code sql:

SELECT sur_dokid FROM table1
WHERE sur_dokid IN ('1026, 1027, 1028')


I would like explode/divide string to array .
Example :
sur_dokid IN ('1026, 1027, 1028') convert sur_dokid IN (1026, 1027, 1028)
(In PHP code is: $array=explode(':','string1:string2:stri
ng3'); )

please help me.
J.O. Aho

2008-03-27, 7:17 pm

janek wrote:
> Hello all,
>
> I have code sql:
>
> SELECT sur_dokid FROM table1
> WHERE sur_dokid IN ('1026, 1027, 1028')
>
>
> I would like explode/divide string to array .
> Example :
> sur_dokid IN ('1026, 1027, 1028') convert sur_dokid IN (1026, 1027, 1028)
> (In PHP code is: $array=explode(':','string1:string2:stri
ng3'); )


It's better you fix your database, create a table where you can have "one to
many" connections.

--

//Aho
janek

2008-03-28, 8:04 am

J.O. Aho pisze:
> janek wrote:
>
> It's better you fix your database, create a table where you can have
> "one to many" connections.
>

Thank's, but I have specyfic structure data base.., I thought that
exists this function 'explode' sql..
Paul Lautman

2008-03-28, 7:12 pm

janek wrote:
> J.O. Aho pisze:
> Thank's, but I have specyfic structure data base..,

Yes, and what Aho is poingint out is that you have a bad structure in your
database. Fix that and you don't have the problem.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com