How to insert value into the database with the help of php?

When we know how to connect the PHP page into the we are starting to know how to insert a value into the database from is code————–

$sql="insert into product values('null','$productname','$quantity')"

$sql= It is a variable to store an inserting values.

product= It is a database table name.

null,$productname, and $quantity= It is a variable of HTML same as database table field name.

when we know how to insert a value in a database from we write a PHP code how to insert a is a code—-

 $connection=mysqli_connect("localhost", "root", "", "stockmanagemant");
 $sql="insert into product values('null','$productname','$quantity')";

In this code, you can also familiar with a  $check and his uses.


Leave a Reply