Jump to content

connect statement


Recommended Posts


$con = mysqli_connect("localhost","mark","library","markdb");

// Check connection

if (mysqli_connect_errno())


echo "Failed to connect to MySQL: " . mysqli_connect_error();


$sql = "INSERT INTO UserNames (FirstName, LastName)

VALUES ('John', 'Doe')";

if ($conn->query($sql) === TRUE) {

echo "New record created successfully";

} else {

echo "Error: " . $sql . "<br>" . $conn->error;




i have my table set to varchar (16)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...