Sir Dog Man Thing
Sir Dog Man Thing

Reputation: 31

Creating a table using mysqli and php

The table is not created in the database Users and there is no error message at all. PhpMyAdmin is set to allow no password, just to be clear on that point.

CREATE TABLE Users(
    ID string(255) NOT NULL,
    FirstName string(255) NOT NULL,
    Surname string(255) NOT NULL,
    DOB date(10) NOT NULL
)

Upvotes: 0

Views: 673

Answers (1)

Ashish Patel
Ashish Patel

Reputation: 633

your query should be like this.

$mySql = CREATE TABLE Users(
         ID VARCHAR(255) NOT NULL,
         FirstName VARCHAR(255) NOT NULL,
         Surname VARCHAR(255) NOT NULL,
         DOB date NOT NULL
    )";
  1. MySQL can't understand string. pass varchar instead of a string.
  2. you don't need to assign the length of date.

Upvotes: 3

Related Questions