Jump to content


Photo

SQL QUERY, ANYONE SPOT IT?


  • Please log in to reply
4 replies to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 10 October 2006 - 01:57 PM

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!

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
);

http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 10 October 2006 - 02:06 PM

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:

The query string should not end with a semicolon


you need to run queries separately through PHP for mysql.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 10 October 2006 - 02:10 PM

well iv seen alot of setup scripts with all the queries like this in one file!
http://thewebsolutionprovider.com - A Solution For Everything Web!

#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 10 October 2006 - 02:13 PM

well iv seen alot of setup scripts with all the queries like this in one file!

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.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#5 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 10 October 2006 - 02:28 PM

ok thats not a problem, iv never had the need to setup a database through php yet!
http://thewebsolutionprovider.com - A Solution For Everything Web!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users