Tag Archives: Database

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 »

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 »

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 »