Login   Register  
PHP Classes
elePHPant
Icontem

Complex query_secure - how to write ?

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PDO Multi Connection Class  >  All threads  >  Complex query_secure - how to write ?  >  (Un) Subscribe thread alerts  
Subject:Complex query_secure - how to write ?
Summary:Am unsure based on docs how to write complex query_secure
Messages:2
Author:Jay Lepore
Date:2013-01-01 22:33:59
Update:2013-01-15 16:56:40
 

  1. Complex query_secure - how to write ?   Reply  
Picture of Jay Lepore
Jay Lepore
2013-01-01 22:33:59
Hello,

If I have a complex select query such as

$sql="select e_sites_control.*, e_companies.*,e_staff.*,e_staff_sites.* from e_sites_control,e_companies, e_staff ,e_staff_sites
where e_sites_control.base_url='someurl.com' AND
(e_companies.company_id=e_sites_control.company_id) AND
(e_staff_sites.site_id=e_sites_control.site_id) AND
(e_staff_sites.default_staff_member='Y') AND
(e_staff.staff_id=e_staff_sites.staff_id)";

How would I write this using your query_secure feature ?

Thank you.

Sincerely,

Jay
CompuMatter

  2. Re: Complex query_secure - how to write ?   Reply  
Picture of Evert Ulises German Soto
Evert Ulises German Soto
2013-01-15 16:56:41 - In reply to message 1 from Jay Lepore
Hi Jay...

the answer is in manual file... im add little more params for a better comprension.

//SELECT statement with option "UNNAMED PLACEHOLDERS":
$params = array(2,'M');
$rows = $db->query_secure("SELECT NAME FROM TB_USERS WHERE ID=? AND GENRE=?;", $params, true, true);
if($rows!=false){
foreach($rows as $row){
echo "User: ". $row["NAME"] ."<br />";
}
}
$rows = null;

Regards!