Jump to content

VARCHAR error.


Jragon

Recommended Posts

Hello,

 

I'm getting a error when trying to use this code:

<?php
$link = mysql_connect('localhost', 'root', '') or die(mysql_error);

$query = 'CREATE DATABASE IF NOT EXISTS frtdb';
mysql_query($query, $link) or die(mysql_error($link));

mysql_select_db('frtdb', $link);

$query = 'CREATE TABLE track_data (
        track_id        INTEGER UNSIGNED    NOT NULL, AUTO_INCREMENT,
        track_name      VARCHAR(32)         NOT NULL,
        track_desc      VARCHAR(250)        NOT NULL,
        track_maker     VARCHAR(32)        NOT NULL,
        track_data      LONGTEXT            NOT NULL)';
mysql_query($query, $link) or die(mysql_error($link));

$query = 'CREATE TABLE user_info(
        user_id         INT UNSIGNED        NOT NULL, AUTO_INCREMENT,
        username        VARCHAR(32)         NOT NULL,
        password        VARCHAR(32)         NOT NULL,
        salt            VARCHAR(32)         NOT NULL,
        tracks_posted   INT UNSIGNED        NOT NULL,
        date_joined     DATE                NOT NULL)';
mysql_query($query, $link) or die(mysql_error($link));

echo 'Database and Tables made!!'

?>

 

Error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' track_name VARCHAR(32) NOT NULL, track_desc ' at line 2

 

I dont see anything wrong with it please help me find out =]

 

Thanks

Jragon

Link to comment
Share on other sites

Hi,

 

after 'NOT NULL' you dont need the comma (only a space)

 

track_id        INTEGER UNSIGNED    NOT NULL, AUTO_INCREMENT,

->

track_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.