PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 11, 2022

[FIXED] What is wrong with my SQL Statement when creating a table

 October 11, 2022     mysql, phpmyadmin, sql     No comments   

Issue

whats wrong with this code?

CREATE TABLE `cars` (
    `id` INT unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `name` varchar,
    `image` varchar
    ) ENGINE = INNODB DEFAULT CHARSET = utf8;

Err:

#1064 - Near '
    `image` varchar
    ) ENGINE = INNODB DEFAULT CHARSET = utf8' in Zeile 3

Can anyone help me to solve this issue ?


Solution

varchar must have a size, when you define it.

So you can choose for example 100

CREATE TABLE `cars` (
    `id` INT unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
    `name` varchar(100),
    `image` varchar(100)
    ) ENGINE = INNODB DEFAULT CHARSET = utf8;


Answered By - nbk
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing