I have faced a scenario where I was getting space error in the email address before @ symbol in email address, as I were making simple post request to verify the login.
Json post object sample:
{
"email": "test@example.com",
"password" : "test123"
}
Was returning error in response of like test @example.com so the email address was not getting verified in the database.
Upon google came to following stack overflow result for solution but not satisfy with the approach of replacing single quote again and forcing self to post the email address with single quote in post request, which is obviously not a good solution. (later I have commented on the result page with my solution 😉 )
Simply I did this at query level and it resolve the space issue in the email address while query in database.
$query = "SELECT * FROM
" . $this->table_name . "
WHERE email = '".$this->email."' LIMIT 0,1";
Finally, wrapped the email address variable with the single quotes, and resolved the issue of space before @ symbol.
Hope this solution and result page will save your day!