Reading data from database table

  PHP is having multiple functions for reading data from database table. Those functions are mysql_fecth_array, mysql_fetch_assoc, mysql_fetch_object. We will see mysql_fetch_array in this chapter. While reading data from a table, these functions fetch data in the form of a single row at a time. Then we have to loop through to fetch all the … Read more

Inserting data in MySql table using PHP

mysql_query() For inserting data in MySql, PHP is having mysql_query() function where we can pass MySQL insert query to insert our data into database tables. Synatx: mysql_query(sql_query, connection); sql_query – its an sql query written in string format. connection –  its connection object returned from mysql_connect function. Before using this function lets create a new … Read more

Connecting database with PHP

We are having certain PHP functions for connecting database with PHP and using the database for various operations. Let’s see them in details. mysql_connect(): In PHP we are having mysql_connect() function to connect PHP application with MySql database. Syntax: connection mysql_connect(<server/host>,<username>,<password>); In above syntax: <server/host> – it’s a host or server of where your database is … Read more

Creating database and tables with phpMyAdmin

For creating database and tables, we can use phpmyadmin. We can use SQL commands with PHP to create a database table and insert, delete, update table records. We will see this in upcoming lessons. In this tutorial, I will show you how to create database and table directly using phpmyadmin. Creating database using below steps: You … Read more

MySql with PHP

The database is the most crucial part of every web application. We can use different types of databases with PHP but MySql is widely used. MySql is free and popular database system which can be used with PHP to create a web application with database handling. Let’s see in details MySql with PHP. Installation of … Read more

Session in PHP

What is Session? Session in PHP is used to store the information on the server which can be accessed at any page in your web application. Session store data on the server, unlike cookies which store data on client’s machine. Session data are stored in a file and that file resides on the server in … Read more

File upload using PHP forms

In File upload using PHP lets directly begin with the example. Consider below example and follow the steps to perform File upload using PHP. In the form add file input field. Set name, action and method attributes <form name=”file_upload” action=”uploads.php” method=”post” > <input type=”file” name=”photo” /> <input type=”submit” value=”Submit” /> </form> In above example, we have … Read more

Cookies in PHP

What are Cookies? Cookies in PHP are small text files which are saved by a browser in your computer. Cookies contain small pieces of data sent by the server, which can be accessed in any script. Cookies are just like PHP variables except that cookies contain that data even after you turn off the computer … Read more

Including files in PHP

Including files in PHP In PHP you can include one PHP file into another and can execute them on the server. For including files in PHP we can use following PHP functions: include() include_once() require() require_once() Let’s see above function in details To learn including files in PHP, let’s say there is a scenario where … Read more

HTTP header in PHP

HTTP Header: In the web application the communication you do with server are mainly through browsers. And browser in actual communicates with server using HTTP header. When you send a request for any web page to the server, a server returns the page along with some more information which is an HTTP header. This information contains the … Read more