I have the following code:
$sql = "SELECT id,name,type FROM $this->objectsTable WHERE name = $key[Name] AND ( ";
foreach( $key['type'] as $pt=>$val)
if( count( $key['type'] ) != $pt + 1 )
$sql .= "type LIKE '%$val%' OR ";
else
$sql .= "type LIKE '%$val%')";
In above code $key is an array that contains my values.
I want add this to the above :
If above code has result then update that row else add my data to table as a new row
Note: The $key array has no 'id'.
Is it possible to do that in one query ?
Thanks.