So I saw some similar questions here but I just could not understand them.
My table:
'timestamp' int(30) NOT NULL,
'clientguid' varchar(32) NOT NULL,
'clientip' varchar(32) NOT NULL,
'serverip' varchar(32) NOT NULL)
I have 4 variables
$TimeStamp
$ClientGUID
$ClientIP
$ServerIP
My query should do this:
if there is a row with clientguid
that matches $ClientGUID
:
UPDATE 'mytablename'
SET 'timestamp' = '$TimeStamp','clientip' = '$ClientIP','serverip' = '2.2.2.24'
WHERE 'mytablename'.'clientguid' = '$ClientGUID');
If there is not a row matching that:
INSERT INTO 'mytablename' ('timestamp','clientguid','clientip','serverip')
VALUES($TimeStamp,'$ClientGUID', '$ClientIP', '$ServerIP');
I don't have to worry about escaping and validating, that has already been done I just need a statement that will accomplish this. :)