SQL Help needed

  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post December 30th, 2008, 10:51 am

What is wrong with the following sql?
Code: [ Select ]
INSERT IF NOT EXISTS INTO forum_acl_options (auth_option, is_global) VALUES ('u_title_edit', 1);
INSERT IF NOT EXISTS INTO forum_acl_options (auth_option, is_global) VALUES ('u_title_ignore_reqs', 1);

INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_days', 30);
INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_posts', 10);
INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_mode', 0);
INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_maxlength', 45);
  1. INSERT IF NOT EXISTS INTO forum_acl_options (auth_option, is_global) VALUES ('u_title_edit', 1);
  2. INSERT IF NOT EXISTS INTO forum_acl_options (auth_option, is_global) VALUES ('u_title_ignore_reqs', 1);
  3. INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_days', 30);
  4. INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_posts', 10);
  5. INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_mode', 0);
  6. INSERT IF NOT EXISTS INTO forum_config (config_name, config_value) VALUES ('custom_title_maxlength', 45);

My phpmyadmin is not allowing me to use it.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 30th, 2008, 10:51 am

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6128
  • Loc: Seattle, WA
  • Status: Offline

Post December 30th, 2008, 12:29 pm

INSERT IF NOT EXISTS is not valid syntax.

Use INSERT IGNORE if you really must perform conditional inserts.
The Beer Monocle. Classy.
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post December 30th, 2008, 1:38 pm

Oh nice. Thanks :)
"Bring forth therefore fruits meet for repentance:" Matthew 3:8

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 188 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.