insert - PHP "Notice: Array to string conversion" error when inserting to SQL -
i'm trying insert values table, keep getting following notice :
notice: array string conversion in c:\program files\wamp\www\process_invitation.php on line 10
line 10 insertion line in following code :
if ((isset($_post['inviter'], $_post['opponent'])) && ($_post['inviter'] != '' && $_post['opponent'] != '' )) { $inviter = $_post['inviter']; $opponent = $_post['opponent']; $now = time(); if ($mysqli->query("insert invitations (inviter_user_id, invited_user_id, time) values ('$inviter','$opponent','$now')")) { return; } }
have tried var_dumping $inviter , $opponent see datatype are? try casting them (string) too. also, it's idea use parameterised queries mysqli. stands, you're leaving wide open sql injections.
Comments
Post a Comment