Hi guys i m trying to write a mysql statement with the IF row count function within the sprintf function but to no avail.
EDIT: This statement is basically for importing an excel spreadsheet, and then processing the data. It checks for duplicates based on the fields that aren't the primary key so the check is needed
Based on the method to insert on duplicate update for a non-PRIMARY key posted here - MySQL insert on duplicate update for non-PRIMARY key
$sql = sprintf("UPDATE tbl_jobs SET a=% WHERE b=%s
IF ROW_COUNT()=0
INSERT INTO tbl_jobs (...) VALUES (...) "),
$varA, $varB");
i believe the problem happens when there is a function nested in the sprintf statement
how do i actually escape the function's brackets in this case? or is this statement wrong to begin with?
any help would be appreciated.
thank you!