Data recovery software easyrecovery cracked PHP script database features (bottom)

Source: Internet
Author: User
Tags php database
Using classes to speed up the development of PHP database
Database access functions are many, improper use can reduce efficiency, and even lead to errors. and PHP itself is open and extensible, a lot of people for it to develop various functions of the source code. Every PHP programmer should be good at inheriting the results of others, saving time and energy. Stand on the shoulders of giants to see farther. Of course, you can also share your code and realize the sense of accomplishment that your labor is recognized and created value.
The use of database classes allows us to focus on the development of the program without having to consider the specific database type at all.
Among the many development toolkits, Phplib is one of the more stable performance and the more perfect function. Phplib can be obtained in http://phplib.netuse.de/. It contains the support classes for the database. Take the MySQL database as an example, Phplib comes with a class named Db_sql. It wraps the database connection, the query, the result, the database table traversal and so on function.
The use of database classes allows us to focus on the development of the program without having to consider the specific database type at all. Even if the database system type is changed, the program code is not changed. At the same time, database classes provide a complete and robust approach to database access, which may be the biggest advantage of using class wrappers.
Below, we use the database classes provided by Phplib to access the database we just created and display the content.
〈?
Require "db_mysql.php";
Contains the build file for the database class
$db =new Db_sql;
Declaring an instance of a database class
$db-〉connect ("resumedb", "localhost", "root", "");
Connecting to the database server
The parameters provided are: database name, hostname, user name, user password
if ($db-〉link_id)
Determine if the connection is established correctly
{
$db-〉query ("Select Id,name,intro from Resume");
Inquire
if ($db-〉nf ())
Determine if the result set is empty
{
while ($db-〉next_record ())
Take the next row of record values until the recordset contents have been exhausted
{
echo "ID:", $db-〉f ("id"); The f () function returns the value of a child segment of the current record
echo "〈br〉";
echo "Name:";
$db-〉p ("Name");
The P () function prints the value of a sub-segment directly
Equivalent to echo $db-〉f ("name")
echo "〈br〉";
echo "Introduction:";
echo $db-〉f ("Intro");
echo "〈br〉";
echo "〈a href=" download.php?id= ". $db-〉f (" ID ")." " View Word document 〈/a〉 ";
echo "〈br〉〈hr〉";
}
}
$db-〉free ();
Freeing resources
}
?〉
As can be seen from the above process, the method of accessing the database with the class and accessing the database directly are basically the same. The difference is that the method we call here is a method of the class, not a function specific to a database. Because of the separation of the code and the specific database type, when the database system changes, we do not have to change the program code, just change the base class implementation method.
If you use the Phplib template to design, you can realize the separation between the program and the display. will also make the program structure clear, web design easy to create.
Simple usage, reasonable assignment of tasks, and thinking of the object packaging will make the website development efficiency greatly improved.
Attached: Code test Platform
Above program code all in the following platform test pass
RedHat Linux 6.1+apache1.3.12+
php4.0+mysql3.22.32
The installation configuration process for the database is:
cd/usr/local/src/mysql*
./configure--refix=/usr/local/mysql
Make
Make install
The installation configuration process for Apache is:
cd/usr/local/src/apache*
./configure--prefix=/usr/local/apache--enable-shared=max
Make
Make install
The installation configuration process for PHP is:
cd/usr/local/src/php*
./configure--with-apxs=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/
Apache/conf
--with-mysql=/usr/local/mysql
--enable-debug=no
--enable-track-vars
The php.ini configuration process is:
Copy Php.ini-dist to/usr/local/
Apache/conf/php.ini
Edit Httpd.conf to remove the comments from the following two lines
AddType application/x-httpd-php. php. php3
AddType Application/x-httpd-php-source. Phps
< <全文完> <全文完> >

The above describes the data recovery software easyrecovery cracked version of the PHP script database function (below), including the data recovery software easyrecovery cracked version of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.