edward1111
-
Posts
3 -
Joined
-
Last visited
Posts posted by edward1111
-
-
Okay. Do you have any code yet? What is it? Is there a problem? How is it not working?
yeah I started it. ill upload give me a few mins.
-
I am trying to connect to my database on xammp, Im trying to find info how to connect and set up for people that sign in to my website they can regsiter for it.
Connect to myphpadmin/ mysql
in MySQL Help
Posted
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myguests";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// sql to create table
$sql = "CREATE TABLE MyGuests (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
)";
if ($conn->query($sql) === TRUE) {
echo "Table MyGuests created successfully";
} else {
echo "Error creating table: " . $conn->error;
}
$conn->close();
?>