Thursday, January 21, 2016

PHP INSERT INTO: Add New Record Into A Database

Data is essential in an organization. So storing it in a database helps an organization to easily store it so they can retrieve it in the near future. Here is a code to insert new record in the database using PHP and MySQL.

Let's assume that you already have your input controls such as textbox, buttons, checkbox, etc.

Table

STUDENT









PHP Code
<?php
$last=$_POST['name of textbox for lastname'];
$first=$_POST['name of textbox for firstname'];
//insert to db
mysqli_query($con,"INSERT INTO student(stud_last,stud_first) values ('$last','$first')") or die(mysqli_error());
?>

Output




PHP INSERT INTO: Add New Record Into A Database

PHP INSERT INTO: Add New Record Into A Database Rating: 4.5 Diposkan Oleh: Emoblazz

0 comments:

Post a Comment