Jump to content

SQL QUERY, ANYONE SPOT IT?


glenelkins

Recommended Posts

hi

anyone spot the problem with this qery?? it errors out on the second create table, but if i do them indiviually it works fine!

[code]
CREATE TABLE tags (
id int not null primary key auto_increment,
name varchar(50)
);

CREATE TABLE tag_values (
id int not null primary key auto_increment,
value text
);

CREATE TABLE tag_values_int (
tag_id int,
value_id int
);
[/code]
Link to comment
Share on other sites

are you trying to call that all at once with mysql_query()? if so, that's your problem, not the syntax of the query. notice this quote from the mysql_query() manual page:
[quote]
The query string should not end with a semicolon
[/quote]

you need to run queries [i]separately[/i] through PHP for mysql.
Link to comment
Share on other sites

[quote author=glenelkins link=topic=111071.msg449841#msg449841 date=1160489431]
well iv seen alot of setup scripts with all the queries like this in one file!
[/quote]
setup scripts will typically have the queries set up like that, and then parse them and run them one at a time. it's a completely different thing to have a single SQL file with all your queries in it and running them all as one single query. look at the install script for any major forum, and you'll see exactly what i'm talking about.
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.