0

and again maybe im been dumb or not seeing something I should but I am having a problem making a table in MySQL using a php script here is the code

$maketable = "CREATE TABLE IF NOT EXISTS $scompany ( 
  id INT(11) NOT NULL AUTO_INCREMENT, 
  deskname VARCHAR(255) NOT NULL, 
  lfloor VARCHAR(255) NOT NULL,, 
  internet ENUM('y','n') NOT NULL DEFAULT 'n', 
  pc ENUM('y','n') NOT NULL DEFAULT 'n',  
  monitor ENUM('y','n') NOT NULL DEFAULT 'n', 
  extra TEXT NULL, 
  PRIMARY KEY (id))";

$tablequery = mysqli_query($db_x, $maketable);

but for some reason it wont work can you help please

4
  • 1
    there is syntax error in query, change your code to $tablequery = mysqli_query($db_x, $maketable) or die(mysqli_error($db_x)); to see it Commented Nov 18, 2013 at 22:02
  • Yeah, let's just die. Because that's what we all do when things don't go as planned, right? We just die. Commented Nov 18, 2013 at 22:03
  • @Sherlock - it depends if your boss is the forgiving type or not! Commented Nov 18, 2013 at 22:04
  • Yeah, I forgot about Apple there for a second. Commented Nov 18, 2013 at 22:06

3 Answers 3

1

You have double comma in part

lfloor VARCHAR(255) NOT NULL,,

What's the point of making separate table for each company? This is very bad idea and will give you many troubles.

Sign up to request clarification or add additional context in comments.

1 Comment

the reason is I was thinking it would be easier for each company to edit their table they need to. but every says its a bad idea so I might rethink it
1

There is a double komma in your Query at the end of this part:

 lfloor VARCHAR(255) NOT NULL,, 

Comments

0

Be glad it doesn't work.

You don't want to do this.

Creating a table for every company, whatever the exact definition of company is in your application, is a Very Bad Thing to do. Try googling the term 'normalization' and see where that gets you.

2 Comments

normalization is of course great thing, but for performance reasons de-normalization can be considered as good option, also this is not an answer to problem
This clearly is no example of denormalizing because of performance issues. Also: this is the answer to the problem, but the problem is of a magnitude different from what the asker thinks it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.