Jump to content
Sign in to follow this  
darbok

connect statement

Recommended Posts

<?php

$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;

}


$conn->close();



?>



i have my table set to varchar (16)

Share this post


Link to post
Share on other sites

what's your question?

Share this post


Link to post
Share on other sites

Add this to the top of your code and see if it gives a better error message:

 

ini_set('display_errors', 1);
error_reporting(E_ALL);

Share this post


Link to post
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
Sign in to follow this  

×