The validation seems to fail for some reason. By the validation, I mean the "if ($result)
" -part. How can I correctly validate SQL-query?
$dbconn = pg_connect("host=localhost port=5432 dbname=heoa user=heoa password=123");
$email = $_POST['login']['email'];
$result = pg_query_params( $dbconn,
'SELECT user_id
FROM users
WHERE email = $1',
array( $email )
);
if ($result)
{
while ( $row = pg_fetch_array( $result ) )
{
$user_id = $row['user_id'];
}
return $user_id;
}