What are you doing?
Is this a Laravel project?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
If I want to do:
$sql = "INSERT INTO u_spares ($sql_left) VALUES ($sql_right)";
but if only my variable does not equal the value of my table column already.
$sql_left = 'is_active, ';
$sql_left .= 'date_added, ';
$sql_left .= 'date_modified, ';
$sql_left .= 'client_id, ';
$sql_left .= 'league_id, ';
$sql_left .= 'player_id, ';
$sql_left .= 'game_id, ';
$sql_left .= 'team_id';
$sql_right = "'$is_active', ";
$sql_right .= "'$date_added', ";
$sql_right .= "'$date_modified', ";
$sql_right .= "'$client_id', ";
$sql_right .= "'$league_id', ";
$sql_right .= "'$player_id', ";
$sql_right .= "'$game_id', ";
$sql_right .= "'$team_id'";
So insert only if my value $game_id does not equal to the value of the game_id column?
Please or to participate in this conversation.