MySQL and PHP

PHP and MySQL work's together most of the time and is the default SQL engine of Linux (next to PostSQL which is also shipped along with MySQL).   MySQL is the most popular SQL engine for Linux and exist in other platform as well.   Just like MySQL, PHP too itself is a multi platform application.

 

Topic listed here-in are the most basic and/or the most commonly used combination needed to work with MySQL and PHP and as follows:

 

Open Connection
Simple Query
Fetch Data as Result Set
Verify Query Operation
Verify SQL Operation
Magic Quotes and Escape Strings
Last Insert

To fetch the last insert ID or the auto incremental value assign after an entry had been inserted (added) into the selected active Table.    Please note that this statement must be executed right after the INSERT SQL command had been executed in order to get the proper value.


   $_SESSION['nrec'] = mysql_insert_id();


I recommend SESSION to be active for this execution.