Google Ads

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. ?>

 

 


Related Post

StoCookie jQuery plugin v1.1 PHP Script Download StoCookie jQuery plugin v1.1 - Cookie Law Compliance and Custom NotificationsStoCookie jQuery plugin v1.1 - Cookie Law Compliance and Custom Notificat...
Text pattern v4.5.4 Blog PHP Script Download Text pattern v4.5.4 Blog PHP Script Download Textpattern is a web application designed to help overcome the hurdles to publishing online, and to si...
Directoryapp v1.08f – Business Directory PHP... Directoryapp v1.08f - Business DirectoryDirectoryapp v1.08f - Business DirectoryDirectoryApp is a business directory script written in PHP. With this ...
Box v1.2 – An Online Cloud Storage Applicati... Box v1.2 - An Online Cloud Storage ApplicationBox v1.2 - An Online Cloud Storage ApplicationBox is an online cloud storage application based on Larave...
Inserting Data in PHP/MySQL v3 PHP Script Inserting Data in PHP/MySQL v3 PHP Script tutorial is going to be on how to insert data in to a MySQL table through PHP. This is in companionship w...

Have any Question or Comment?

Leave a Reply

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