UPDATED: As suggested in comment section I have updated my code and using PDO now. I still have the same error. I am trying to store multiple images to the database (phpmyadmin). When I try to upload it gives an error Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘file.png’ in ‘field list’ My database: I have an database named
Tag: database
Laravel Eloquent ORM: Select from two tables without using find() possible?
Basically I would like to run a very simple database select query accross two tables in mysql considering a one-to-many-relationship. categories: This table contains all product-categories. The primary key is “id”. It has one column “url” which holds the string how to access this category, e.g. “greeting-cards”. products: This table contains all products whereas each product has one category id.
empty data in Laravel query
my response always empty ! if I run only one (where) separated in the Query I get data but if I run all three ( where ) Its empty ! my output Answer Change your controller code to something like this And if there’s an OR condition between branch and type then change your code like this
Issues converting stdClass to array
I have converted one of my websites to use PDO database queries. All the queries are working perfectly except one and I have spent all day trying to solve this problem and nothing is working for me so …
Error when saving data on a specific date and time
I have a server with Debian 10,Apache/2.4.38, MySQLi, mongodb and Php. The server is running a custom PHP program which allows users to upload their measurements (in .csv files) which are then stored in mongodb. The uploaded .csv files must comply with a predetermined format in order to be uploaded, like so: The timestamp must be set every 15 minutes
NEWID function causing error for prepared statement in MYSQL
I am trying to create a forgot password system, so I am using the NEWID() function to create a random code to be sent to the user’s email. I am using prepared statements to prevent SQL injections, but …
Call to undefined method links()
I’m trying to display featured game in my home page but i’m getting the error : Call to undefined method IlluminateDatabaseEloquentBuilder::links() when i’m changing in the HomeController : From …
JS function not found when calling PHP function on server but works on local server
As stated in the title my code works in local but not on server. More precisely, when i call whatever PHP function it doesn’t find my JS function. To sum it up : The goal here is to generate an excel …
Problems specifying Laravel Eloquent database at runtime
Laravel 5.8. I am trying to save an Eloquent model, choosing the database connection at runtime: My config/database.php file: My problem is that each time I run this code, the cat is created in the mysql (default) database, rather than the staging database, even when USE_STAGING is true. Answer The problem is the static call of the create() method. By
Add Year to NOW()
I am trying to add a year to a date going into a SQL database from PHP. I have tried DATEADD(Year,1,NOW()) And various other forms but can’t seem to get it to add a year onto it in SQL. <?php …