in reply to Dynamic SQL
You should use placeholders.
(minor tweaks to fix typos..)$query1="(select Name from Customers where CustId=?)"; $query2="(select Name from Sales where SalesId=?)"; $sth1=$dbh->prepare($query1); $sth2=$dbh->prepare($query2); if ($x>10) { $sth1->execute($custid); } else { $sth2->execute($salesid); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Dynamic SQL
by pme (Monsignor) on Apr 06, 2015 at 15:55 UTC | |
Re^2: Dynamic SQL
by Anonymous Monk on Apr 06, 2015 at 15:39 UTC | |
by bitingduck (Deacon) on Apr 06, 2015 at 15:57 UTC | |
by erix (Prior) on Apr 06, 2015 at 16:02 UTC | |
by tye (Sage) on Apr 07, 2015 at 03:47 UTC | |
by bitingduck (Deacon) on Apr 06, 2015 at 17:16 UTC | |
by erix (Prior) on Apr 06, 2015 at 17:21 UTC | |
| |
by Anonymous Monk on Apr 06, 2015 at 18:22 UTC |