Category Archives: Tutorial

Updating Data within the Database Using PHP

If you want to update any record within the table of the database then you can make use of the mysql_query function and use the update command.  You can use any query using the mysql_query function and solve your purpose. Example:  <?php         if(isset($_POST[‘update’])) {  $db_host = ‘localhost:3036’;   $db_user = ‘root’;   $db_pass = ‘rootpassword’;   $db_conn = mysql_connect($db_host, $db_user, $db_pass);… Read More »

Using Paging via PHP

Whenever we fetch data from the database, we are nor sure about the amount of record that is present there. We need to manage the record so that it would not look messy and should be handled in an appropriate way. So we have to divide the records to be displayed per page that’s where we use the… Read More »

PHP – Inserting the Data to the Database

Inserting data to the database is the same process as creating or deleting the database. You can use the same function mysql_query to add the data to the table. Example- <?php $db_host = ‘localhost:3036’; $db_user = ‘root’; $db_pass = ‘rootpassword’; $db_conn = mysql_connect($db_host, $db_user, $db_pass); if(! $db_conn ) { die(‘Connection failed: ‘ . mysql_error()); } echo ‘Success’; $db_sql… Read More »

Deleting the Database using PHP

You can delete the database in the same manner as you created the database using the mysql_query function. Example <?php $db_host = ‘localhost:3036’; $db_user = ‘root’; $db_pass = ‘rootpassword’; $db_conn = mysql_connect($db_host, $db_user, $db_pass); if(! $db_conn ) { die(‘Error: ‘ . mysql_error()); } echo ‘Success’; $db_sql = ‘DROP Database demo_db’; $db_retval = mysql_query( $sql, $conn ); if(! $db_retval… Read More »

Creating a Database using PHP

Creating Database PHP allows the use of mysql_query function to create a database. But in order to create and delete a database, you must have admin rights on the database. This function takes two parameters to create a database. Syntax bool mysql_query (sql, connection); Where, SQL is the query with which you will create the database. Connection (optional)… Read More »

PHP and MySQL

Well, PHP has support for almost every database like oracle, Sybase but developers mostly prefer MySQL database over others. Before starting with the programming we need to have some pre-requisite for the database part. You should have downloaded the compatible version of MySQL for your PHP. Create a database that will store your PHP data and connect with… Read More »

PHP – Date and Time

PHP allows you to use many date functions along with many modifiers that help you to perform some operations on a date. You can even manipulate date using PHP date and time functions. Use of time() function If you want all the information about the current date and time, then PHP helps you with time() function. This function… Read More »