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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...