Microsoft
Software
Hardware
Network
Question : make only one query
Hello I want to know if I can and how make one query where is say if exists update else insert... but I'm not finding a good refrence on it.. this is the base of what I have
$query = "INSERT INTO ".cms_db_prefix()."module_
feusers_bo
oking (id, `Set`, TB, SD, HO, DA) VALUES (
".$uid.", ".$SetPart.", ".$timeBlocksIncro.", ".$startOfDay.", ".$hoursOpen.", ".$DayAhead.")";
and it's the id that is the thing to look for...
thank you
Jeremy
Answer : make only one query
MYSQL does this a bit different than the commercial database engines. (DB2 and Oracle use the MERGE statement which was added to the standard about 2003.)
In MYSQL, use INSERT INTO mytable .... ON DUPLICATE KEY UPDATE ....
Good Luck,
Kent
Random Solutions
Batch file in XP or 2003 to delete ALL files AND folders in a specified directory
sql dts failure DBNETLIB connectionread general network error
Deny access local disk
Java and Action Script games
Refresh button in OWA with Exchange 2007 SP1
How to clone a laptop SATA HDD with an external SATA HDD connected via USB?
How to isntall the ODBC DSN for Symantec Endpoint
Auto Close Email when you reply
exchange 2007 mailbox server install fails with"Access to address list service on all Exchange 2007 servers has been denied
How to Clone two identical server running on Raid 5