Raised This Month: $51 Target: $400
 12% 

SQL insert into if not exists


Post New Thread Reply   
 
Thread Tools Display Modes
aleeexxx
Member
Join Date: May 2014
Location: Valhalla
Old 08-13-2018 , 01:01   Re: SQL insert into if not exists
Reply With Quote #11

Quote:
Originally Posted by Neuro Toxin View Post
Make sure your SteamID column is a unique or primary key.

Then use INSERT INTO .. ON DUPLICATE UPDATE ..

http://www.mysqltutorial.org/mysql-i...te-key-update/

I agree with him,

I use this for my vip system:

For create table:

PHP Code:
CREATE TABLE IF NOT EXISTS vip 
  

     
steamid                TEXT UNIQUE
  
); 
And for insert data into without duplicate:

PHP Code:
INSERT OR IGNORE INTO vip (steamidVALUES ('%s'); 
__________________

Last edited by aleeexxx; 08-13-2018 at 01:24.
aleeexxx is offline
Send a message via MSN to aleeexxx
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode