Jump to content

Archived

This topic is now archived and is closed to further replies.

glenelkins

SQL QUERY, ANYONE SPOT IT?

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]

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
well iv seen alot of setup scripts with all the queries like this in one file!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
ok thats not a problem, iv never had the need to setup a database through php yet!

Share this post


Link to post
Share on other sites

×

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.