The code is as follows
Require (".. /inc/pdo.php "), function output ($action, $select, $name) {$select = $dbc->prepare (" Select Id,ztname,zttype,zttime, Headimg,riseimg from Naszt where 1=1 and Zttype=:zttype "); $select->bindvalue (": Zttype ", $action); $select Execute (); $result = ", while ($row = $select->fetch ()) {$result. = '
EXEC (' Set CHARACTER set UTF8 '); $dbc->setattribute (Pdo::attr_emulate_prepares, false); Disable prepared statements emulation}catch (Pdoexception $e) {echo $e->getmessage ();}? >
I want to call PDO in function
Do you want to inherit this class from the PDO in which you write class function?
Ask the great God to show how to write!
Reply to discussion (solution)
If not on the basis of global
Contains PDO class files, instantiates classes, and gives parameters.
Contains PDO class files, instantiates classes, and gives parameters.
OK, in addition I would like to ask you, PDO how to splice SQL Ah, such as where 1=1 and Tile=null no value is ignored
Recommend a look at this AH
http://php.xlxz.org/2013/11/370/
Pdo_query (' show databases '); Var_dump ($sql, $db->dbversion ()); Exit $sql = $db->select (' i.kd K, io.id dk, iil.ii ds ')->from (' Test T ')->leftjoin (' Post P ', ' t.id =? ') , Array (2))->order (' name DESC, id ASC ')->where (Array (' Xin =? And do >? ' = = Array (1,3))->having (Array (' xin ' = ' dkls ')->group (' id ') Limit (3,4)->queryall (); Exit;//var_dump ($sql); $sql = $db->from (' Test ')->insert (' kd ' = ' 233 ', ' dkwe ' = 323); $sql = $db->from (' Test ')->where (Array (' (DK =? and kd >?) or (DK =? and DDD =?) ' = = 2,3,5,4))->limit (2, 4)->update (Array (' dkddl ', ' = ' d ', ' kdls ' = ' dkdl ')); $sql = $db->from (' test,test ')->select (' Test,test ')->where (array (' id ' = = = Array (3,3,4, 2, 3))->limit (' 3 ', 3)->delete ();
Contains PDO class files, instantiates classes, and gives parameters.
OK, in addition I would like to ask you, PDO how to splice SQL Ah, such as where 1=1 and Tile=null no value is ignored
Where you can just spell a variable and assign a value when you need it.
As needed
$where = "where xxxx=xxx";
Otherwise
$where = "";
$SQL = "SELECT * from XXX $where";