dimanche 2 juillet 2017

laravel how to properly esacpe inet_aton insertion?

so for example to save user ip into db:

$ip = Request::getClientIp();
...
$post->user_ip = DB::raw("inet_aton('$ip')");
$post->save()

I don't really like this code how to properly escape the $ip variable?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire