note 113716 deleted from mysqli.quickstart.connections by peehaa
| From: | peehaa@php.net | Date: | Mon, 02 Dec 2013 09:34:02 +0000 |
| Subject: | note 113716 deleted from mysqli.quickstart.connections by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197718@lists.php.net to get a copy of this message | ||
Note Submitter: hiteshsharma30683 at gmail dot com
----
<?php
$con=mysqli_connect("localhost","root","","abc");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO Persons (FirstName, LastName, Age)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>