dv9000 battery
 
HomePortalCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 MySQL Storage system Handling in PHP.

View previous topic View next topic Go down 
AuthorMessage
Admin
Admin


Posts : 313
Join date : 2011-09-04

PostSubject: MySQL Storage system Handling in PHP.   Wed Sep 21, 2011 7:56 pm

Virtually all interactive websites nowadays require data to always be presented dynamically and interactively based on input from the owner. For example, a customer may prefer to log into a retail website to take a look his purchasing history. In such a case, the website would get stored two types of data as a way for the customer to carry out the check – typically the customer’ s personal membership details; and the customer’ 's purchased items. This data are generally stored in two types of storage – flat files or databases.
Flat files are simply feasible in very small to low volume internet websites as flat files find 3 inherent weaknesses:
The choice which is, in my estimation, the only feasible solution, is to store the data in a database. By far the most prevalent databases in benefit from is MySQL. Data which may be stored in a database can possibly be indexed, managed and stored efficiently. Besides that, most databases also provide a suite of accompanying utilities that let the database administrator to conserve the database – for example of this, backup and restore, and so.
Websites scripted using PHP are very suitable for the MySQL database as PHP provides a custom and integrated MySQL module that communicates very efficiently with MySQL. PHP may well communicate with MySQL from your standard ODBC as MySQL is usually ODBC-compliant, However, this is definitely not as efficient as using the custom MySQL module pertaining to PHP.
The rest of this article is a tutorial about how to use PHP to:
Starting a Session by means of MySQL
Before the PHP script can communicate with the database to query, insert or update all the database, the PHP script will first have got to connect to the MySQL server and specify which database on the MySQL server to run using.
The mysql_connect() and mysql_select_db() functions are provided for this reason. In order to url to the MySQL server, typically the server name/address; a username; and a valid password is required. Once a connection is successful, the database needs to generally be specified.
The following 2 code excerpts illustrate how to perform the server connection and database selection:
@mysql_connect('[servername]', '[username]', '[password]') or die('Cannot connection to DB! ');
@mysql_select_db('[databasename]') and / or die('Cannot select DB! ');
The @ operator used to suppress any malfunction messages that mysql_connect() plus mysql_select_db() functions may produce if an error occurred. The die() function used to end the software execution and display some sort of custom error message.
Running SQL Statements against a fabulous MySQL database
Once the connection and database selection is actually successfully performed, the PHP script is now able to proceed to operate at the database using standard SQL statements. The mysql_query() function used for executing standard SQL statements against the database. In the soon after example, the PHP script requests a table called tbl_login in your previously selected database to determine if a username/password pair made available from the user is applicable.
Assumption:
The tbl_login table has 3 columns given the name login, password, last_logged_in. The last_logged_in column stores the moment that the user last logged throughout the system.
The above example demonstrated how a SELECT SQL statement is executed about the selected database. The same method is used to execute other SQL phrases (e. g. UPDATE, INTRODUCE, DELETE, etc. ) with database using the mysql_query() and additionally mysql_affected_rows() functions.





About The author
This PHP scripting article is authored by John L. John L will be Webmaster of The Supreme BMW Blog! (http: //www. bimmercenter. com).
Ab muscles BMW Blog!
daboss@bimmercenter. com
Back to top Go down
View user profile http://dv9000.createforum.co.uk
 
MySQL Storage system Handling in PHP.
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» [ANSWERED] UDF File System?
» [IMPLEMENTED] Registry tweak to disable File System Tunneling
» [ANSWERED] How to change the Logo at Control Panel -> System
» How to reformat and reinstall your Operating System
» Acer System Recovery Partition Hotkey & Instructions (eRecovery)

Permissions in this forum:You cannot reply to topics in this forum
dv9000 battery :: Your first category :: Your first forum-
Jump to: