Framework, the database contains two tiers, one zz_db.php, and one zz_model.php
Use:
Project portal Definition Database parameters:
Mysql
Define (' Zz_mysql_host ', ' 127.0.0.1 ');
Define (' Zz_mysql_user ', ' root ');
Define (' ZZ_MYSQL_PW ', ');
Define (' zz_mysql_db ', ' microblog_home '); Only one database operation is temporarily available
Define (' Zz_mysql_table_pre ', ' mh_ ');
Build yourself in the project's model layer, for example: Usermodel.php extends zz_model.php
See zz_model.php for the parameters required for each method and the results returned.
Database Operation methods:
Increase:
$array = Array (
' Username ' = ' 123456789 ',
' Password ' = ' TTT ',
' Reg_time ' = Time (),
);
$result = $this->insert ($array);
Check: (Multiple data)
(Returns a two-dimensional array or null)
$field = Array (' username ', ' password ');
$option = Array (
' id ' = ' [<] '. $a,
' [or]username ' = ' Alazalaz ',
' Password ' = ' [>=]ssss ',
' [or]mail ' = ' xxx ',
);
$this->select ($field, $option, 7);
Select Username,password from Mh_user where id< ' 2222 ' or username= ' Alazalaz ' and password>= ' ssss ' or mail= ' xxx '
limit 7
Check: (a piece of data)
Ditto (but returns an array or empty)
$this->select_one ($field, $option, 7);
Change:
$field = Array (' state ' =>1);
$option = array (' id ' = ' 2 ');
$this->update ($field, $option);
About my PHP framework, how to use the database tier