simple -
Moderator: General Moderators
simple -
Hi,
I have a file that has a bunch of sql statements, mixed in with code and comments. For example,
select p.first_nm, p.last_nm, p.img_file, ..... from party p,
I want to capture the sql statements - 'SELECT through the word FROM' - using regex, but I couldn't figure out the tutorials. I was under the impression regex would create an array of all of the occurences?
I am making sure there are NO selects without the from keyword, say burried in the comments or something....
Any help would be appreciated.
regexless in colulmbus
I have a file that has a bunch of sql statements, mixed in with code and comments. For example,
select p.first_nm, p.last_nm, p.img_file, ..... from party p,
I want to capture the sql statements - 'SELECT through the word FROM' - using regex, but I couldn't figure out the tutorials. I was under the impression regex would create an array of all of the occurences?
I am making sure there are NO selects without the from keyword, say burried in the comments or something....
Any help would be appreciated.
regexless in colulmbus
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
it'd be hard to give an exact pattern unless you posted examples of what is in the file, involving not only a query, but many lines around it to understand what can and can't be in the pattern. However, I will throw out a generic pattern, as it may work in your instance.
Code: Select all
preg_match_all('#(SELECT .*?FROM)#si',$text,$matches);
var_export($matches);regex master needed
Hey Feyd.... you da mmmMAAan...
Sorry - I should have provided a better example - your code worked as is... but I tried to expand it and I couldn't get it to work
The file is below between the code
How would modify your preg_match_all statement to find all of the text between
SELECT and $filter so for example select t.col1, t.col2, t.col3 from mytable t $filter $order - would return or place 'select t.col1, t.col2, t.col3 from mytable t $filter' into the array
see I know the dollar sign means end of line, but here it's a variable passed into this file for the WHERE clauses in the sql statements.
Any Help Would Be Great
Thanks
Sorry - I should have provided a better example - your code worked as is... but I tried to expand it and I couldn't get it to work
The file is below between the code
How would modify your preg_match_all statement to find all of the text between
SELECT and $filter so for example select t.col1, t.col2, t.col3 from mytable t $filter $order - would return or place 'select t.col1, t.col2, t.col3 from mytable t $filter' into the array
see I know the dollar sign means end of line, but here it's a variable passed into this file for the WHERE clauses in the sql statements.
Any Help Would Be Great
Thanks
Code: Select all
<?
/////////////////////////////////////////////////////////////////////////////////////////
//function to get data
function getData($request_page, $table_view, $filter, $order, $purpose)
{
global $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//build sql statement based on the table -
//for complex data sets test for and include $filter and $order
switch($table_view)
{
case $table_view :
{ //list of all tables from the passed in databasse
if($purpose == "SHOW ALL TABLES") //keep the format and spacing for $purpose EXACT
{
$sql_statement = "SHOW TABLES FROM $table_view";
$script_error = " retrieving a list of all tables in the database";
}
elseif($purpose == "SHOW COLUMNS") //keep the format and spacing for $purpose EXACT
{
$sql_statement = "SHOW COLUMNS FROM $table_view";
$script_error = " retrieving a list of columns for the table or view $table_view";
}
break;
}
case "sys_element_attribute_spec" :
{
if($purpose == "SHOW ALL FORM ELEMENTS and ATTRIBUTES") //keep the format and spacing
{
$sql_statement = "SELECT seas.* FROM `sys_element_attribute_spec` seas $filter $order";
$script_error = " retrieving a list of elements and their attribute specifications";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
else if ($purpose == "MAX ORDER NUMBER")//keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT MAX(link_order) FROM LINKS $filter";
$script_error = " Retrieving hyper link order or arrangement on page";
}
//reportError($request_page, $script_error , $purpose , $sql_statement);
break;
}
case "sys_form_specification" :
{
if($purpose == "SHOW ALL FORM SPECIFICATIONS")//keep the format and spacing for $purpose
{
$sql_statement = "SELECT fp.*, FROM `sys_form_specification` $filter $order";
$script_error = " retrieving list of form specifications";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
else if ($purpose == "MAX ORDER NUMBER")//keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT MAX(link_order) FROM LINKS $filter";
$script_error = " Retrieving hyper link order or arrangement on page";
}
//reportError($request_page, $script_error , $purpose , $sql_statement);
break;
}
case "party": //keep the format and spacing for $purpose EXACT
{
if($purpose == "PARTY AND IMAGES REGARDLESS of ROLE")
{
$sql_statement = "SELECT p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc FROM be_party p, be_image i $filter $order";
$script_error = " retrieving party and images regardless of role";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
break;
}
case "content" :
{
if($purpose == "GENERAL DISPLAY") //keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT c.*, p.person_fnm, p.person_lnm FROM `content` c, `party_content` pc, `party` p $filter $order";
$script_error = " Retrieving General Display Content/Article and Author(s)";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
else if ($purpose == "MAX ORDER NUMBER")//keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT MAX(link_order) FROM LINKS $filter";
$script_error = " Retrieving hyper link order or arrangement on page";
}
//reportError($request_page, $script_error , $purpose , $sql_statement);
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link)
{
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else
{
// SQL Query - should select each column by name
$result = mysql_query($sql_statement, $db_link);
if(!$result)
{
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function getData
/////////////////////////////////////////////////////////////////////////////////////////
//function to set or update data
function setData($request_page, $table_view, $update_string, $filter, $uid){
global $db_host, $db_user, $db_pwd, $db_name, $db_default_name, $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//build sql statement based on the table -
//for complex data sets test for and include $filter and $order
switch($table_view){
case "links" : {
$current_date = date("Y-m-d, H:i:s");
$sql_statement = "UPDATE LINKS SET ";
$sql_statement .= $update_string;
$sql_statement .= ", last_update_dt = '" . $current_date . "' " . $filter;
$script_error = "Updating hyper links.";
//here to see what the SQL statement is
//reportError($request_page, $script_error ,"No SQL result - testing only " , $sql_statement);
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link){
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else{
//reportError($request_page, $script_error, $no_result, $sql_statement);
// SQL Query - should select each column by name
$result=mysql_query($sql_statement, $db_link);
if(!$result){
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function
/////////////////////////////////////////////////////////////////////////////////////////
//function to add or insert data
function addData($request_page, $table_view, $insert_string, $purpose, $uid){
global $db_host, $db_user, $db_pwd, $db_name, $db_default_name, $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//this may be used with all inserts
$current_date = date("Y-m-d H:i:s");
//build sql statement based on the table -
switch($table_view){
case "web_issue" : {
$sql_statement = "INSERT INTO web_issue VALUES('', ";
$sql_statement .= $insert_string;
$sql_statement .= " )";
//here to see what the SQL statement is
$script_error = "Inserting a new web issue";
//reportError($request_page, $script_error ,"No SQL result - testing only " , $sql_statement);
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link){
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else{
// SQL Query - should insert a row into a table or view
$result=mysql_query($sql_statement, $db_link);
if(!$result){
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function
/////////////////////////////////////////////////////////////////////////////////////////
//function to delete data
function removeData($request_page, $purpose, $table_view, $filter, $uid ){
global $db_host, $db_user, $db_pwd, $db_name, $db_default_name, $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//build sql statement based on the table -
//for complex data sets test for and include $filter and $order
switch($table_view){
case "event" : {
if($purpose == "DELETE EVENT"){
$sql_statement = "DELETE FROM event $filter";
$script_error = "Deleting event from admin area per user request. User ID: " . $uid;
}
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link){
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else{
// SQL Query - should select each column by name
$result=mysql_query($sql_statement, $db_link);
if(!$result){
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function
?>- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
it appears all the selects are given in a single string, so you could possibly use this:
Code: Select all
preg_match_all('#"(SELECT. ?)"#si',$text,$matches);
var_export($matches);Only one word?
Hey Feyd,
Uh... your
preg_match_all('#(SELECT. ?)#si', $starting_string, $matches);
it doesn't give me the entire sql string, it only grabs the word select. I really want the entire string, from the 'SELECT word all the way through the $filter word, which is a variable but reading it in a text file it's just a word....
so for example I 'SELECT .........................$filter' - is what I wanted to grab. Starting with 'SELECT' then all the words up through and including the word '$filter'.
Thanks!!!
VmusiV
Uh... your
preg_match_all('#(SELECT. ?)#si', $starting_string, $matches);
it doesn't give me the entire sql string, it only grabs the word select. I really want the entire string, from the 'SELECT word all the way through the $filter word, which is a variable but reading it in a text file it's just a word....
so for example I 'SELECT .........................$filter' - is what I wanted to grab. Starting with 'SELECT' then all the words up through and including the word '$filter'.
Thanks!!!
VmusiV
Sorry.... I'm kind of /[S-L-O-W]/
Hi Feyd,
I tried putting a plus sign in where the space was - as shown below........
preg_match_all('#(SELECT.+?)#si', $starting_string, $matches);
var_export($matches);
I am still getting just the select
Isn't there a way to match a phrase that starts with 'SELECT' and ends with '$filter' ????
Thanks for your patience!!!
VmusicV
I tried putting a plus sign in where the space was - as shown below........
preg_match_all('#(SELECT.+?)#si', $starting_string, $matches);
var_export($matches);
I am still getting just the select
Isn't there a way to match a phrase that starts with 'SELECT' and ends with '$filter' ????
Thanks for your patience!!!
VmusicV
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
Code: Select all
preg_match_all('#"(SELECT.+?)"#si',$text,$matches);
var_export($matches);If not that, try
Code: Select all
preg_match_all('#(SELECT.+?\$filter)#si',$text,$matches);
var_export($matches);Crying Endlessly
OK.... I've tried and I've tried let me put it this way
while(date() < eternity){
try preg_match expression;
cry because it doesn't work;
}
I SWEAR... I've tried every combination, I've esaped, brought back, added subtracted, meta-charactered and even called 911
I just want a preg_match expression that will pull all the occurences of 'SELECT.......filter' out of the text file, which I already moved into a variable above
Thanks
No Really Thanks
VmusicV
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
This sure seems to work:Outputs:
Code: Select all
<?php
$text='
<?
/////////////////////////////////////////////////////////////////////////////////////////
//function to get data
function getData($request_page, $table_view, $filter, $order, $purpose)
{
global $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//build sql statement based on the table -
//for complex data sets test for and include $filter and $order
switch($table_view)
{
case $table_view :
{ //list of all tables from the passed in databasse
if($purpose == "SHOW ALL TABLES") //keep the format and spacing for $purpose EXACT
{
$sql_statement = "SHOW TABLES FROM $table_view";
$script_error = " retrieving a list of all tables in the database";
}
elseif($purpose == "SHOW COLUMNS") //keep the format and spacing for $purpose EXACT
{
$sql_statement = "SHOW COLUMNS FROM $table_view";
$script_error = " retrieving a list of columns for the table or view $table_view";
}
break;
}
case "sys_element_attribute_spec" :
{
if($purpose == "SHOW ALL FORM ELEMENTS and ATTRIBUTES") //keep the format and spacing
{
$sql_statement = "SELECT seas.* FROM `sys_element_attribute_spec` seas $filter $order";
$script_error = " retrieving a list of elements and their attribute specifications";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
else if ($purpose == "MAX ORDER NUMBER")//keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT MAX(link_order) FROM LINKS $filter";
$script_error = " Retrieving hyper link order or arrangement on page";
}
//reportError($request_page, $script_error , $purpose , $sql_statement);
break;
}
case "sys_form_specification" :
{
if($purpose == "SHOW ALL FORM SPECIFICATIONS")//keep the format and spacing for $purpose
{
$sql_statement = "SELECT fp.*, FROM `sys_form_specification` $filter $order";
$script_error = " retrieving list of form specifications";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
else if ($purpose == "MAX ORDER NUMBER")//keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT MAX(link_order) FROM LINKS $filter";
$script_error = " Retrieving hyper link order or arrangement on page";
}
//reportError($request_page, $script_error , $purpose , $sql_statement);
break;
}
case "party": //keep the format and spacing for $purpose EXACT
{
if($purpose == "PARTY AND IMAGES REGARDLESS of ROLE")
{
$sql_statement = "SELECT p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc FROM be_party p, be_image i $filter $order";
$script_error = " retrieving party and images regardless of role";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
break;
}
case "content" :
{
if($purpose == "GENERAL DISPLAY") //keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT c.*, p.person_fnm, p.person_lnm FROM `content` c, `party_content` pc, `party` p $filter $order";
$script_error = " Retrieving General Display Content/Article and Author(s)";
//reportError($request_page, $script_error , $purpose , $sql_statement);
}
else if ($purpose == "MAX ORDER NUMBER")//keep the format and spacing for $purpose EXACT
{
$sql_statement = "SELECT MAX(link_order) FROM LINKS $filter";
$script_error = " Retrieving hyper link order or arrangement on page";
}
//reportError($request_page, $script_error , $purpose , $sql_statement);
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link)
{
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else
{
// SQL Query - should select each column by name
$result = mysql_query($sql_statement, $db_link);
if(!$result)
{
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function getData
/////////////////////////////////////////////////////////////////////////////////////////
//function to set or update data
function setData($request_page, $table_view, $update_string, $filter, $uid){
global $db_host, $db_user, $db_pwd, $db_name, $db_default_name, $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//build sql statement based on the table -
//for complex data sets test for and include $filter and $order
switch($table_view){
case "links" : {
$current_date = date("Y-m-d, H:i:s");
$sql_statement = "UPDATE LINKS SET ";
$sql_statement .= $update_string;
$sql_statement .= ", last_update_dt = \'" . $current_date . "\' " . $filter;
$script_error = "Updating hyper links.";
//here to see what the SQL statement is
//reportError($request_page, $script_error ,"No SQL result - testing only " , $sql_statement);
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link){
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else{
//reportError($request_page, $script_error, $no_result, $sql_statement);
// SQL Query - should select each column by name
$result=mysql_query($sql_statement, $db_link);
if(!$result){
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function
/////////////////////////////////////////////////////////////////////////////////////////
//function to add or insert data
function addData($request_page, $table_view, $insert_string, $purpose, $uid){
global $db_host, $db_user, $db_pwd, $db_name, $db_default_name, $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//this may be used with all inserts
$current_date = date("Y-m-d H:i:s");
//build sql statement based on the table -
switch($table_view){
case "web_issue" : {
$sql_statement = "INSERT INTO web_issue VALUES(\'\', ";
$sql_statement .= $insert_string;
$sql_statement .= " )";
//here to see what the SQL statement is
$script_error = "Inserting a new web issue";
//reportError($request_page, $script_error ,"No SQL result - testing only " , $sql_statement);
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link){
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else{
// SQL Query - should insert a row into a table or view
$result=mysql_query($sql_statement, $db_link);
if(!$result){
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function
/////////////////////////////////////////////////////////////////////////////////////////
//function to delete data
function removeData($request_page, $purpose, $table_view, $filter, $uid ){
global $db_host, $db_user, $db_pwd, $db_name, $db_default_name, $mysql_errno, $mysql_error, $no_db_connection, $no_result;
//build sql statement based on the table -
//for complex data sets test for and include $filter and $order
switch($table_view){
case "event" : {
if($purpose == "DELETE EVENT"){
$sql_statement = "DELETE FROM event $filter";
$script_error = "Deleting event from admin area per user request. User ID: " . $uid;
}
break;
}
} //end of switch
/////////////////////////////////////////////////////////////////////////////////////////
//connect to the db and get the results
$db_link = db_connect();
if(!$db_link){
//error handling
reportError($request_page, $script_error, $no_db_connection, $sql_statement);
$result = -1;
}
else{
// SQL Query - should select each column by name
$result=mysql_query($sql_statement, $db_link);
if(!$result){
//error handling
reportError($request_page, $script_error, $no_result, $sql_statement);
$result = -2;
}
return $result;
}
} //end function
?>';
preg_match_all('#"(SELECT.+?)"#si',$text,$matches);
var_export($matches);
?>Code: Select all
array (
0 =>
array (
0 => '"SELECT seas.* FROM `sys_element_attribute_spec` seas $filter $order"',
1 => '"SELECT MAX(link_order) FROM LINKS $filter"',
2 => '"SELECT fp.*, FROM `sys_form_specification` $filter $order"',
3 => '"SELECT MAX(link_order) FROM LINKS $filter"',
4 => '"SELECT p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc FROM be_party p, be_image i $filter $order"',
5 => '"SELECT c.*, p.person_fnm, p.person_lnm FROM `content` c, `party_content` pc, `party` p $filter $order"',
6 => '"SELECT MAX(link_order) FROM LINKS $filter"',
),
1 =>
array (
0 => 'SELECT seas.* FROM `sys_element_attribute_spec` seas $filter $order',
1 => 'SELECT MAX(link_order) FROM LINKS $filter',
2 => 'SELECT fp.*, FROM `sys_form_specification` $filter $order',
3 => 'SELECT MAX(link_order) FROM LINKS $filter',
4 => 'SELECT p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc FROM be_party p, be_image i $filter $order',
5 => 'SELECT c.*, p.person_fnm, p.person_lnm FROM `content` c, `party_content` pc, `party` p $filter $order',
6 => 'SELECT MAX(link_order) FROM LINKS $filter',
),
)SwweeEEEEEeeeeTTT
Feyd,
Thank you so much. Yes it does work. I was testing it with the wrong string variable.
All I have to say is:

Thanks!!!
no really
Thanks!!!!
Vmusic
Thank you so much. Yes it does work. I was testing it with the wrong string variable.
All I have to say is:

Thanks!!!
no really
Thanks!!!!
Vmusic
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
I just now was working on this...it works in my way as well..
I have the entire file in my host space
Output:
I have got the information btw select and from keywords as well..
I have the entire file in my host space
Code: Select all
$fileString = file_get_contents("sampleDoc.txt");
echo $fileString;
preg_match_all("#(select(.*?)from.*?)$#im", $fileString, $matches);
var_export($matches);I have got the information btw select and from keywords as well..
Code: Select all
array (
0 =>
array (
0 => 'SELECT seas.* FROM `sys_element_attribute_spec` seas $filter $order";
',
1 => 'SELECT MAX(link_order) FROM LINKS $filter";
',
2 => 'SELECT fp.*, FROM `sys_form_specification` $filter $order";
',
3 => 'SELECT MAX(link_order) FROM LINKS $filter";
',
4 => 'SELECT p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc FROM be_party p, be_image i $filter $order";
',
5 => 'SELECT c.*, p.person_fnm, p.person_lnm FROM `content` c, `party_content` pc, `party` p $filter $order";
',
6 => 'SELECT MAX(link_order) FROM LINKS $filter";
',
),
1 =>
array (
0 => 'SELECT seas.* FROM `sys_element_attribute_spec` seas $filter $order";
',
1 => 'SELECT MAX(link_order) FROM LINKS $filter";
',
2 => 'SELECT fp.*, FROM `sys_form_specification` $filter $order";
',
3 => 'SELECT MAX(link_order) FROM LINKS $filter";
',
4 => 'SELECT p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc FROM be_party p, be_image i $filter $order";
',
5 => 'SELECT c.*, p.person_fnm, p.person_lnm FROM `content` c, `party_content` pc, `party` p $filter $order";
',
6 => 'SELECT MAX(link_order) FROM LINKS $filter";
',
),
2 =>
array (
0 => ' seas.* ',
1 => ' MAX(link_order) ',
2 => ' fp.*, ',
3 => ' MAX(link_order) ',
4 => ' p.party_id, p.party_type, p.person_fnm, p.person_mnm, p.person_lnm, p.org_nm, p.tagline, p.address_ln1, p.address_ln2, p.address_city, p.address_state, p.address_zip, p.phone1, p.phone1_type, p.phone2, p.phone2_type, p.email, p.website, i.image_file_nm, p.img_file_nm, p.map_img_file_nm, p.login_id, p.login_pwd, p.login_reminder, p.login_last_updated, p.created_user_id, p.created_date_ts, p.last_updated_user_id, p.last_updated_date_ts, p.party_desc ',
5 => ' c.*, p.person_fnm, p.person_lnm ',
6 => ' MAX(link_order) ',
),
)- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
the array is being output by var_export() which creates a literal representation of the contents of the variable given to it. In this case, strings are being stored in an array. If you look carefully, each of the strings are single-quote strings. The ending quote is often on the following line. Your regex is grabbing the trailing double quote because each of the selects is being captured until an end of line is found, which happens to be after the double quote. Mine captures the contents of double quoted strings. Slightly differing behavior.