I'm trying to move to laravel, and my old app still uses mysql_query. Is it possible to bypass the following error i'm getting in laravel?
ErrorException
mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
Please let me know - rewriting all SQL queries is not an option right now. Maybe in the future, but right now, I want to get up and running.
Also, I'm using a DB class to run the queries through mysql, is there a better way to move to PDO vs rewriting every single SELECT, UPDATE, DELETE, and CREATE query?
Thanks!
If you are using mysql_query() it means that you are using raw queries to execute your logic. You can use laravel's raw queries to execute.
http://laravel.com/docs/database#running-queries
However, there is a down side for the CRUD queries you'll still have to do a bit of customization for example running an insert statement would be like this.
DB::insert('insert into users (id, name) values (?, ?)', array(1, 'Dayle'));
Plus side will be it will automatically sanitize the input so you don't have to worry about sql injections etc. I don't think there is a more quicker way of doing this in laravel.