session

Sessions are global variable that can store values and will be accessible throughout the site .The applications that uses session are user login,cart etc . Session values are stored in the server and it will will have reference to a an session id which will be generated when some one call session_start() and will be stored in the local machine

Once the session id created , this id will be passed to the server along with request and with the help of this the code can fect the values stored in  the server .

Session values can be managed with the help of  $_SESSION[] .

Session can be destroyed using the function session_destroy()

Session values will get destroyed if the browser is closed .

Example

<?php
session_start();
$_SESSION[‘lan’]=”PHP Code”;
echo $_SESSION[‘lan’] ;
session_destroy();
?>

SQL FULL JOIN

SQL FULL JOIN  return rows when there is a match in one of the tables

Syntax

SELECT * FROM table_name1 FULL JOIN table_name2
ON table_name1.column_name=table_name2.column_name

MySQL Table – users

|+—-+——+
| id | name |
+—-+——+
|  1 | AAAA |
|  2 | BBBB |
|  3 | CCCC |
|  4 | DDDD |
|  5 | EEEE |
+—-+——+

MySQL Table – Orders

+—–+—–+——–+
| oid | uid | items  |
+—–+—–+——–+
|   1 |   1 | Pen    |
|   2 |   2 | Watch  |
|   3 |   3 | shoe   |
|   4 |   4 | mobile |
+—–+—–+——–+

Example

mysql> SELECT u.name,o.items FROM users as u FULL JOIN orders as o ON u.id=o.uid ;
+——+——–+
| name | items  |
+——+——–+
| AAAA | Pen    |
| BBBB | Watch  |
| CCCC | shoe   |
| DDDD | mobile |
+——+——–+
4 rows in set (0.00 sec)

SQL SELECT

The SELECT statement is used to select data from a database.

SQL SELECT Syntax

SELECT field_names FROM table_name

Field name should be seperated with comma .

If you want the data from all the fields ,then just use “ * “

MySQL Table – users

+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | JS   |
|  3 | HTML |
|  4 | JSP  |
|  5 | ASP  |
+—-+——+

Example

mysql> select * from users;
+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | PHP  |
|  3 | PHP  |
|  4 | PHP  |
|  5 | PHP  |
+—-+——+

mysql> select name  from users;
+——+
| name |
+——+
| PHP  |
| JS   |
| HTML |
| JSP  |
| ASP  |
+——+

MySQL

MySQL is a relational database management system (RDBMS)that runs as a server providing multi-user access to a number of databases. It is named after co-founder Michael Widenius’ daughter, My. The SQL phrase stands for Structured Query Language.
The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation.
Free-software-open source projects that require a full-featured database management system often use MySQL. For commercial use, several paid editions are available, and offer additional functionality.