friends. I am trying to create function in MySQL using this script: CREATE FUNCTION CurrentMemoDepartment(MID INT) RETURNS INT BEGIN DECLARE DeptID INT; SET DeptID = 0; SELECT TOP 1 TDeptID INTO …
Tag: mysql
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 …
Laravel 6: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
everyone! I need some help. I’m creating a web app in laravel 6 that lets the user insert data through php forms that is also inserted into a database. Basically, I create a Supplier (it’s working), …
Integrity constraint violation in laravel
I am passing the ID in URL to get to the Form Page I want but I want to pass in the same ID when I hit the submit button and I want to pass in the same ID to the database table name “created_by” …
docker wordpress container can’t connect to mysql container
I’m at a loss here as to not only why this isn’t working but how to further troubleshoot it. I’m new to docker, so could be something obvious, but I can’t find it. I did look over some other links …
Store variable from SQL Table to use later using PHP
I would like to be able to store a variable from a column to use to update a variable in another column. Here is my code: $sqlPlaceNumber = “SELECT @locationPlace := `$locationPlace` FROM `$…
Sorting of columns by joining two tables in Laravel
I have two tables books and publishers. publisher_id is primary key in publishers table and foreign key in books table. In index.blade.php of books, I want to create link for sorting of columns of …
Displaying table data in modal with PHP and JavaScript
I’m still somewhat new to PHP and JavaScript. I’m working on a web application that involves me displaying some data in a table using PHP and MySQL. I would like to be able to click on a row of the …
Is it possible to sort all php data into various divs by the day of week
Hello im here with a problem, i want to retrieve data from mysql with php(done it :)) and then for example when my variable $dia_semana is equal to sunday, it will show all the data with sunday into …
Display Average Rating by Id with Count of Ids Mysql
I have an MYSQL table, where I want to get the average rating with a count of product id. Here is the sample of the table. ╔════╦═════════════╦══════════╦══════════╗ ║ ID ║ product_Id ║ rating ║ …