Connecting PHP and MYSQL - Formula Sheet
Core Functions and Parameters
Below is a quick reference table of key PHP database connection functions, parameter structures, and their return behaviors.
| Function Name | Syntax and Parameters | Return Value | Description |
|---|---|---|---|
| mysqli_connect | mysqli_connect(host, username, password, dbname) | Connection object (or false on failure) | Establishes a connection to the MySQL server and selects the specified database. |
| mysqli_query | mysqli_query(connection_link, query_string) | Result object (for SELECT) or boolean (for INSERT/UPDATE/DELETE) | Sends an SQL query to the database server for execution. |
| mysqli_close | mysqli_close(connection_link) | Boolean (true on success, false on failure) | Closes an open connection link and releases system resources. |
| mysqli_connect_error | mysqli_connect_error() | String describing the error (or null) | Returns a textual explanation of the last connection failure. |
| mysqli_num_rows | mysqli_num_rows(result_object) | Integer (number of rows) | Retrieves the total number of records returned by a SELECT query. |
| mysqli_fetch_array | mysqli_fetch_array(result_object) | Array representing the row (or false if none) | Fetches the next row of data as an associative or numeric array. |
Key Configuration Rules
- Server Host: Typically 'localhost' when executing scripts on the same server where the MySQL database resides.
- Default Port: MySQL server usually listens on port 3306. This is handled internally unless specified otherwise in advanced parameters.
- PHP Version Minimum: PHP version 5.0.0 or higher is required to use the mysqli extensions natively.
இந்தப் பாடத்திற்கு மேலும்
புத்தகப் பயிற்சி வினாக்கள்10 பாடநூல் வினாக்கள் · விடையுடன்
கூடுதல் வினாக்கள்15 கூடுதல் வினாக்கள் · விடையுடன்
பயிற்சித் தேர்வுஊடாடும் · உடனடி மதிப்பெண்
புத்தகப் பயிற்சித் தேர்வுபாடநூல் தொகுப்பில் உங்களைச் சோதியுங்கள்
கூடுதல் வினாத் தேர்வுகூடுதல் தொகுப்பில் உங்களைச் சோதியுங்கள்
படிப்புக் குறிப்புகள்கருத்துகளும் முறைகளும்
கணினி பயன்பாடுகள் பாடத்தின் மற்ற பாடங்கள்
அனைத்தையும் பார்க்க
1 பல்லூடகம்
2 அடோப் பேஜ்மேக்கர் – ஓர் அறிமுகம்
3 தரவுதள மேலாண்மை அமைப்பு – ஓர் அறிமுகம்
4 மீவுரை முன்செயலி (PHP) – ஓர் அறிமுகம்
5 PHP செயற்கூறுகள் மற்றும் அணிகள்
6 PHP-ல் உள்ள நிபந்தனைக் கூற்றுகள்
7 PHP-ல் மடக்குகள்
8 படிவங்கள் மற்றும் கோப்புகள்
10 கணினி வலையமைப்பு ஓர் அறிமுகம்
11 வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள்
12 களப்பெயர் முறைமை (DNS)
13 வலையமைப்பு வடமிடல்
14 திறந்த மூல கருத்துருக்கள்
15 மின்-வணிகம்
16 மின்னணு செலுத்தல்கள் முறைகள்
17 மின்-வணிக பாதுகாப்பு அமைப்புகள்
18 மின்னணு தரவு பரிமாற்றம்