how to use this query.

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

how to use this query.

Post by spamyboy »

Code: Select all

ON DUPLICATE ENTRY UPDATE `freq`=`freq`+1
How to use it with:

Code: Select all

$keyword=mysql_query("INSERT INTO `search_queries` (`query`, `freq`) VALUES ('$keyword', `freq`)")or die("Insert Error: ".mysql_error());
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

got it:

Code: Select all

$keyword=mysql_query("INSERT INTO `search_queries` (`query`, `freq`) VALUES ('$keyword', `freq`) ON DUPLICATE KEY UPDATE `freq` = `freq` + 1")or die("Insert Error: ".mysql_error());
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Why did this require a new thread?
User avatar
spamyboy
Forum Contributor
Posts: 266
Joined: Sun Nov 06, 2005 11:29 am
Location: Lithuania, vilnius

Post by spamyboy »

The problem was that I wasnt able to find nothing about

Code: Select all

ENTRY
query in mysql and basicly it showed up that man who told me it was wrong - he ment KEY.
Post Reply