Forum Moderators: coopster
$result = mysqli_query($dbcnx, "CALL sp_EditCompanyItem('$userName','$remoteIP','$userAgent','$_GET[id]','$fieldname','$content')") or die ("An error occurred!: " . mysqli_error($dbcnx));
The stored procedure looks like this:
BEGIN
SET @strQuery = CONCAT('UPDATE Companies SET ', $field_name, ' = \'', $field_value, '\' WHERE ID = ', $cmp_id, ';');
PREPARE strQuery FROM @strQuery;
EXECUTE strQuery;
INSERT INTO Journal
(
journalDT,
UserID,
IPAddress,
Browser,
Message
)
VALUES
(
NOW(),
$user_id,
$ipAddress,
$browser,
CONCAT('Updated Company ', $field_name, ' to "', $field_value, '" for Company "', $cmp_id, '"')
);
SELECT $cmp_id AS 'companyID';
END
The error I'm getting when attempt to call this procedure is: An error occurred!: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '' WHERE ID = 1' at line 1
To me this looks like a simple syntax issue but I can't seem to figure out exactly where it is. Any ideas?