I have two tables that store data for students – the students table and student_session table students table structure student_session table structure Now, I’ve been able to get the total number of students in a class using this query However, there are some students who have been disabled for non…
Tag: mysql
Add new option to the select list without reloading the page – MODAL
I’m trying to append a new option in the select list without refreshing the page once the user added a new option through the bootstrap modal I able to achieve it but there is one problem I’m facing. I also need to append the customer_id in the value attribute of the option tag Select Tag Ajax cal…
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint in laravel 8
hi i am trying to make category and then subcategory so if a category is deleted subcategory would also be deleted here what i have done so far created a model called category also created a subcategory model run the migration for the category in my subcategories migration i have defined the when i try to mig…
How can I overwrite my file images in laravel
I would like to ask how can i overwrite/update my images inside the form and store in database? I tried doing it but it is not working, i get the id correct but when i upload new image and text, it is not updating my old file. Below i attached my code. company controller edit modal for company I might
Why Inserting a value in a nullable field from a HTML FORM gives me a NULL even if it is not?
I created a database with a table that contains both mandatory and nullable fields. When I insert mandatory fields everyhing works fine, but when I try to insert a value in a field that is optional and can be NULL i always get a NULL result when checking the database. Here’s the code: (user_id is mandat…
Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?
i want to ask you how to select FOREIGN KEY (from “doa_id in “doas” table) when user create a new data (to the “notes table) in a form. This is my code : NoteController.php 2021_05_28_020438_create_notes_table.php migration and this is my dropdown html : In Dropdown option, I want to s…
Laravel 8 database connection not working
Trying to connect laravel 8 app in production to mysql database. Have tried to follow documentation but it isn’t working. .env file as follows DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 …
how do i count the amount of rows under a username?
I am making a forum and on the homepage I want to make some kind of a leaderboard where you can see the top 10 posters + and how much they have posted. I want to only get those users out of the database. Ill add a picture of my database. Please let me know. Database Answer I don’t know
MySQL database is not receiving any data in PHP
I created two classes: a class called index.php for a user to input data such as: name, email, phone number and address. And the other class called model.php, which must send the information that the user typed into the MySQL database. However, when a user enters the information in the graphical interface, an…
How to retrieve Mysql data from todays date using PHP
I am using the PHP time() function to get the current time and Insert it into the database. I can also retrieve date by setting the value in a variable and doing something like: date(Y-m-d, $time) But now I want to get a result from the Database on the current date compared to the time inserted in the Databas…