Google Ad:

Insert Data into MySQL Database using PHP, MySQLi, AJAX and JQuery PHP Script


Insert Data into MySQL Database using PHP, MySQLi, AJAX and JQuery PHP Script

This tutorial will show you how to insert data into mysql database using PHP, MySQLi, AJAX and JQuery. You might wonder why use AJAX and JQuery when you can insert into database using PHP and MySQLi. Yes, but with the use of AJAX and JQuery, you don’t need to reload the page in doing an action. This tutorial will not give you a good design but will give you idea on the topic.

 

  1. CREATE TABLE `post` (
  2. `postid` INT(11) NOT NULL AUTO_INCREMENT,
  3. `post_text` VARCHAR(200) NOT NULL,
  4. `date_time` datetime NOT NULL,
  5. PRIMARY KEY(`postid`)
  6. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

 

 

Creating our Connection

Next step is to create a database connection and save it as “conn.php”. This file will serve as our bridge between our form and our database. To create the file, open your HTML code editor and paste the code below after the tag.

 

  1. <?php
  2. //MySQLi Procedural
  3. $conn = mysqli_connect(“localhost”,“root”,“”,“ajax_insert”);
  4. if (!$conn) {
  5. die(“Connection failed: “ . mysqli_connect_error());
  6. }
  7. ?>

 

 

Read Me

 



Find More Insert Data into MySQL Database using PHP, MySQLi, AJAX and JQuery PHP Script

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories