I was trying to make a sql database and i have faced some issues regarding INSERT INTO TABLE. I have noticed that sql is not allowing me to insert data in a table if the name of Database is u759286173 i am able to insert data into table using any other name but this particular (u759286173) database name is not allowing me to insert data in table
I have tried various database names which works
- 759286173
- 759286173_quebec
- 759286173_grvnaz
- u_grvnaz
Can someone please explain me that why data is not inserting in table when i allow the database name to be u759286173
My Database name : u759286173 My Table name : mydb
Please reply if u face the same issue or have a solution. Any help is appreciated.
My Code
<?php 
$dbServername = "localhost"; 
$dbUsername = "root"; 
$dbPassword = ""; 
$dbName = "u759286173"; 
$dbHost = " localhost"; 
$conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName);
other code
<?php 
session_start(); 
include 'dbh.inc.php'; 
if (isset($_POST) & !empty($_POST)) { 
    $first = $_POST['first']; 
    $last = $_POST['last']; 
    $email = $_POST['email']; 
    $message = $_POST['message']; 
    $sql = "INSERT INTO mydb (first, last, email, message) 
                VALUES ('$first', '$last', '$email', '$message');"; 
    mysqli_query($conn, $sql); 
    header("location: ../signup.php?send=success"); 
} else { 
    header('location: ../failed.php'); 
    exit(); 
} 
?> 
Form Code
<!DOCTYPE>
    <html>   
        <body>
            <form class="registerform" action="includes/contact.inc.php" method="POST">
                <input type="text" placeholder="first" name="first" required/>
                <input type="text" placeholder="last" name="last" required/>
                <input type="email" placeholder="E-mail ID" name="email"/>
                <input type="text" placeholder="message" name="message" required/>
                <button name="submit" type="submit">Create</button>
            </form>
        </body>
</html>
=Database u759286173
CREATE TABLE IF NOT EXISTS `mydb` (
  `id` int(11) NOT NULL,
  `first` varchar(32) NOT NULL,
  `last` varchar(32) NOT NULL,
  `email` varchar(50) NOT NULL,
  `message` varchar(150) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
     
    