i’m trying to make a form with the ability to upload files using form i’m able to store string, int data but i’m a bit lost with the way that i need to provide for the controller and the view this is the add template: this is the database table: controller: model: app: i can provide more cod…
Tag: mysql
How to get user ID, username from PHP and MySQL while user is logged in
I have this issue where I can’t get user ID and username from database and store it into variable while user is logged in.(Only works with e-mail.) This is my code. Answer You are calling the “execute” method of prepared statement but nowhere you are calling the “fetch” method. S…
Fetch rows from a table if their ids are in a serialized value in another table
I want to fetch values from one table (people) if their ids are within the serialized data of another table (groups). In the table groups I have this row that contains this serialized data stored: Here’s converted to an array so it’s easier to look at I have another table, people, that has thousan…
Reset to default value depending with the year
I want to automatically reset the value in hours_remaining to its default value according to year. I also want the year to auto-incremented. Can anyone give me some advise or help on how to implement this? By the way I’m new to using Php MySql. From this: To this when another year: Answer This is the pe…
I’m working at laravel project but there is always that error : ErrorException Creating default object from empty value
this is my candidatController.php the error is in the line before the last line($prev_canditure->etat=”archifé”;) Answer From your code you can use a defensive code approach by checking if the query will return null
CodeIgniter 4: Pass $data to the View file
Can someone help me with this? I can’t figure out on how can I show the results on the View file. I tried using $this->load->view(‘list-logs’,$data); but it shows the error Call to a member function view() on null. CONTROLLER VIEW Answer if you use CodeIgniter 4 then you must call the …
How can I fetch results from a junction table and insert them as an array into a JSON object using PHP?
I have Articles with Categories in a mysql Database. I would like to print out all Articles with their corresponding Categories as JSON in PHP to fetch with my Vue-App. I’m working with the following tables: Articles, Categories and Article_has_Category (junction table, many to many): The following PHP-…
PHP telnet array reply parsing to store on mysql database
Hi guys i have a small project going on, and this project requires me to send a cmd via telnet to a device and i get a reply and it troughs out the ansewer on a array.. i need to parse this data só i can store in on a mysql table.. this is the data output reply from the
how to save new data and update data in a different table with laravel
How can i save a record new and update data in 2 different tables in laravel. I have perpustakaan table for to update. My second table is called peminjaman_buku for save new data. I hope you can help me, thank you very much controller : when I do the process there is no updated data or new data in the
Compare two columns from two related tables using scopes in Laravel 9
I’m trying to create a scope that will compare two columns on two related tables. Based on these tables I would like to be able to get all instances of the ServiceCall model where the next_service_date is within the next 15 days, where the Customer model either has a null value for the last_contact_date…