Library program design initialization file-PHP source code

Source: Internet
Author: User
Library program design initialization file php code

 
 Name = $ name; // $ this-> price = $ price; // $ this-> author = $ author;} function _ set ($ property_name, $ value) {return $ this-> $ property_name = $ value;} function _ get ($ property_name) {if (isset ($ this-> $ property_name )) {return $ this-> $ property_name;} else {return null;} function add () // add bibliography {$ db = new database (); $ query = "insert into Computer (name, price, author)"; $ query. = "VALUES ('$ this-> name', $ this-> price,' $ this-> author')"; $ d B-> execute ($ query); $ db = null;} function update () // modify the bibliography {$ db = new database (); $ query = "UPDATE Computer SET"; $ query. = "name = '$ this-> name', price = $ this-> price, author =' $ this-> author '"; $ query. = "WHERE id = $ this-> id"; $ db-> execute ($ query); $ db = null;} function delete () // DELETE the bibliography {$ db = new database (); $ query = "delete from Computer WHERE id = $ this-> id"; $ db-> execute ($ query ); $ db = null;} static function query ($ condition) // query the bibliography {if ($ Condition = "" | $ condition = null) $ condition = ""; else $ condition = "WHERE ". $ condition; $ db = new database (); $ query = "SELECT * FROM Computer ". $ condition; $ arr = $ db-> query ($ query); return $ arr; $ db = null ;}/ * $ B = new book ("C language ", 15.20, "Wu Qiang"); $ B-> add (); // $ B->__ set (new_author, "3 "); // $ B-> update (); // $ B-> delete (); // */?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.