Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL - Newbie query

Status
Not open for further replies.

rvr1

Programmer
Feb 6, 2004
16
NL
Hi,

I am undertaking my first project using PHP and mySQL.

What I wish to do is:

After a user has completed a form, I wish to query a table to see if a record with the same name exists. If this exists, certain fields in that record should be updated.

If a record does not exist, a completely new record is added to the table.

Can anyomre please help me with the SQL query I would need to use for this?

Many Thanks.

 
Yeah, you can do it.

Assuming, of course, that rvr1 is running alpha-revision software. The "ON DUPLICATE KEY UPDATE" clause is only available on MySQL 4.1.0.

I find it best in the fora to assume that members are asking questions about production software unless otherwise specified.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
excellent point, my good sir

usually i preface my suggestions with "if you're on 4.1..."

musta forgot this time, sorry

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top