I am trying to build a form in my laravel app to get all users’ profiles that are in or x km around one selected city from my cities table. I’m trying to use the laravel-mysql-spatial that makes use of the ST_DISTANCE_SPHERE mysql function but cant really wrap my brain around the eloquent stuff ne…
Tag: mysql
PHP Wrap ALL fields in quotes fputcsv()
I’m relatively new to PHP so please bear with me. my code currently looks like this: This works as expected, however, the client requires ALL fields to be wrapped in quotations, not just those containing spaces. I’ve seen a lot of solutions online but they all seem overly complicated or seem to su…
Query returns old data
I have a mysql query that counts how many orders have been made on my website: SELECT COUNT(`orderid`) FROM `orders` WHERE `completed` = 1 It works fine, but only when you refresh the page. If …
Getting error of no such file or directory while doing command php artisan migrate on laravel on Ubuntu linux OS
I m in ubuntu 20.04.I installed fresh laravel and when i set all .env configuration, also database but getting error as below: SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = laravel1 and table_name = migrations and table_type = ‘BASE T…
Inserting data into a table using foreign keys in MySQL
I am trying to insert data into a contacts table using foreign keys in mysql, the structure of tables are as follows CONTACTS TABLE id contactname phone_number fk_id USERS TABLE pers_id …
populating php dropdown options with mysql result values shows “Array” when I sort() the array
Edit: When I commented out the sort() line, now it is populating properly. PHP sort looks in-place so I don’t know what happened. I also had to insert a redundant <div> right above the form to either get the array of option values from a session variable or calling the querying function to get it …
query don´t show one result
i have this query: i can show my result, but always don´t show all, i want to say that if my result it´s 3 my query show 2 when all my result have the same result. all data have state=”pendiente” table user table asistencia table actuacion table contratan i attached my migration for you can show m…
Issue with PHP Login Mechanism [closed]
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 1 year ago. Improve this question I hope you are all having a wonderful day so far. I have a question in rega…
Unable to update a field in phpMyadmin using PHP
I have been trying to update a field in database using php, everytime I run the script there is no effect on the table. Here’s how my code looks : where $link is the connection variable which is working fine with other queries. Here’s the table structure. The $result variable is returning true. I …
How to set conditions for search in prepared statements?
I am trying to create a site search in prepared statements, Here is my code : Conditions for search This is how I add it to query : Here is my question. How can I use conditions safe way in prepared statements ? Answer You can build up an array of any bind parameters dynamically and then pass this to