If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

REPLACE works exactly like INSERT, except that if an old row in the table has the same value as a new row for a PRIMARY KEY or a UNIQUE index, the old row is deleted before the new row is inserted. See Section 12.2.5, “INSERT Syntax”.

REPLACE is a MySQL extension to the SQL standard. It either inserts, or deletes and inserts. For another MySQL extension to standard SQL—that either inserts or updates—see Section 12.2.5.3, “INSERT ... ON DUPLICATE KEY UPDATE Syntax”.

If the same data is to be entered, I want a message to show, which states that the person is already in the mailing list. Otherwise I want the details to be added. A user may have signed up through the website and the business may enter someone's details through the control panel. I want to have the control panel entry show when someone is already in the db.

I'll play about with the RaiseError and PrintError part of the connection. Maybe printError isn't enabled which is why it won't print out the message.

Bazz

"The day you stop learning is the day you become obsolete"! - my late Dad.

Oh, Blimey, I made the PrintError adjustment to the wrong db connection.

I have now set it like this

Code:

'RaiseError' => 0, 'PrintError' => 1

OK, I seem to have it resolved because I am now getting the correct message outputted. Just to test all other subs that use that connection in case their outputted message might change from that of $DBD::errstr or $DBI::errstr.

As ever, thanks for the help FishMonger.

bazz

"The day you stop learning is the day you become obsolete"! - my late Dad.