Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am using Eloquent for my new PHP project. But at some point I needed to run some raw sql queries. How can I set up eloquent so that I can run raw sql too ?
User::select(DB::raw('name as full_name'))->get();
I have use DB::raw to setup the select query. There are many possible ways here. Make sure raw code does not break with ORM changes like changing table etc.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
I want to understand how apiplatform works and for this have to understand sql query, how i can watch this ?
i dont see anythings about this in documentation.
You can use the profiler for debug SQL query from API Platform.
https://symfonycasts.com/screencast/api-platform/profiler
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
In order to find websites with potential sql injections, it is possible to use google dorks like "inurl:.php?id="
From the results that google will give, does it mean all the websites listed use sql database (mysql, oracle or any other)?
As it is a backend call, we can't exactly say, that it related to a Database as well. The reason is that while captured based on $_GET['id'], the returning value can be decided only upon the backend, solely based on PHP. So SQL connection is not essentially needed in that purpose.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
but i have this project for school,
i need to make a blog with a database connection.
I have one using mysqli but we are only allowed to use PDO, and in don't know how i can convert it in to PDO can someone help me?
A good link for you : Migrate from mysql extension to pdo
And take the time to read the PDO manual here : http://php.net/manual/fr/book.pdo.php
Sorry but, I cant give you more specific information if you dont share us the code that gives you trouble.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to get back single row where a user just added a new car. I am trying to join all tables using the eloquent ORM. here is a erd of my database I am new to laravel, and I would want to know how I would be able to achieve this. Thanks in advance.
What have you tried already?
Assuming you want to get latest added Car model, you could do
$latestCar = Car::orderBy('id', 'DESC')->first();
If you have nothing yet, you could watch Laracasts about how to build a database and set up Models.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
What is the equivalent of the below in SQL?
PHP function for MySQL:
mysqli_real_escape_string($POST['password']);
Escaping is done to prepare a SQL statement correctly. There is no equivalent in MySQL because by the time it hits that layer it should have been escaped in the first place.
Using mysqli_real_escape_string is also a sign you're doing something incorrectly as you should be using the bind_param method instead of this kind of super low-level call.