0
I have the following appointment
SELECT * FROM myTable WHERE ip = 192.168.1.2
I would like to make a query by sending parameter by name using DB::raw()
$dados = DB::raw("SELECT * FROM myTable WHERE ip = :ip", ["ip" => '192.168.1.2'])
It is possible?
I tried that way but I couldn’t
I want to do so, because if you have a query that repeats again the parameter I do not have to repeat variable
What do you really want to do??? I don’t understand ... just answering that you asked that way there not there ... !
– novic
Instead of using
?
by parameter as some name. Example:WHERE id = ?
useWHERE id = :id
, in some queries I need to repeat this id– adventistaam
I understood, but, no
\DB::raw
doesn’t have that.– novic
Etntendi! Beauty, thanks!
– adventistaam