Page 1 of 1

How to concatenate values from an array to form an SQL q?

Posted: Wed May 24, 2006 2:28 am
by pravonline
Dear All,

I would like to how to concatenate the values from an array to form a complete sql query, say for example

The array looks like this :

Arraytest[1] = "SELECT"
Arraytest[2] = "*"
Arraytest[3] = "FROM"
Arraytest[4] = "TABLE1"
Arraytest[5] = "WHERE"
Arraytest[6] = "NAME"
Arraytest[7] = "="
Arraytest[8] = "BUSH"

And from this i need to form a SQL qury like this ""SELECT * FROM TABLE1 WHERE NAME = 'BUSH'" and need to pass this into a Variable "$test", number of subscript of this array depends upon the length of query, can any one guide me how to do this? Since i'm a mainframe professional and new to this technology!!

Thank you,
Antony

Posted: Wed May 24, 2006 3:05 am
by neogeek

Code: Select all

$test = implode(' ', $Arraytest);
Hope that's what you are looking for.

Thanks Mr.Neo Geek

Posted: Wed May 24, 2006 3:39 am
by pravonline
Thank you so much Mr. Neo Geek, That is what exactly i want, Thanks once again for your valuable reply,

Regards,
Antony :D