[PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread DvDmanDT
That doesn't work as the new string already is like select * FROM `table` where id='2' order by name assuming $value was 2... Hatem Ben [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Greetings all, I got a headache doing this, i need to get vars inside an sql query. For example :

Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Chris Hayes
At 13:54 12-6-03, you wrote: I got a headache doing this, i need to get vars inside an sql query. For example : $query = select * FROM `table` where id='$value' order by name; preg_match_all(/^('\$(.*)')/si, $query,$matches); That doesn't work as the new string already is like select * FROM

Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
Oh, ok this is how i want to do it exactly : query.php ?php $query = select * FROM `table` where id='$value' order by name; ? parse.php ?php $fcontents = join('' , file('query.php')); preg_match_all(/^('\$(.*)')/si, $fcontents,$matches); print_r($matches) ? Thanks

Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
Sorry this is more correct : -- starting query.php select * FROM `table` where id='$value' order by name -- ending query.php Hatem Ben [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Oh, ok this is how i want to do it exactly : query.php ?php $query

RE: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Monu Ogbe
Hi, I'll join the conversation, because I have a similar problem. PHP interpolates variable values in strings if these are enclosed in double quotes: e.g., $string = select * FROM `table` where id='$value' order by name; PHP does not interpolate variables contained in strings delimited

RE: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Jay Blanchard
[snip] $string = select * FROM `table` where id='$value' order by name; [/snip] I know it ain't pretty, but the coding style we have accepted is this $string = select * FROM `table` where id = ' . $value . ' order by name ; or (we requite caps on reserved words)... $string = SELECT *

RE: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Monu Ogbe
PROTECTED] Subject: RE: [PHP] Re: Vars inside an sql query [Regular expression question] Hi, I'll join the conversation, because I have a similar problem. PHP interpolates variable values in strings if these are enclosed in double quotes: e.g., $string = select * FROM `table` where id='$value

Re: [PHP] Re: Vars inside an sql query [Regular expression question]

2003-06-12 Thread Hatem Ben
inside an sql query [Regular expression question] [snip] $string = select * FROM `table` where id='$value' order by name; [/snip] I know it ain't pretty, but the coding style we have accepted is this $string = select * FROM `table` where id = ' . $value . ' order by name ; or (we