SQL Help needed

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

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.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6252
  • Loc: Seattle, WA

Post 3+ Months Ago

INSERT IF NOT EXISTS is not valid syntax.

Use INSERT IGNORE if you really must perform conditional inserts.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8399
  • Loc: USA

Post 3+ Months Ago

Oh nice. Thanks :)

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 45 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.