I have a function that is supposed to delete a product and, with it, delete its stock as well. But it keeps just deleting the stock. SSometimes I change the order of the querys and it shows an error that I can’t delete idproduto because its an FK, so I put the delete stock query first. It deletes the stock
Tag: php
Connecting to multiple MySQL database in single php app [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’m trying to connect multiple mysql databases to a single php web app. I’d like each user to be able
Error in nonaggregate column which is not functionally dependent on columns in GROUP BY clause in sql
Error Number: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column codelone.tags.post_id which is not functionally dependent on columns in GROUP BY clause; …
How to use a for loop to insert multiple records in a database table
I have simplified my problem into the following code: $sql_abc = “CREATE TABLE $tbl_abc( x INTEGER(255) ) “; echo “About to execute $sql_abc”; if (mysqli_query($conn, $sql_abc)…
PHP Prepared MySQL UPDATE Statement with Variable inside of a string
I am trying to include a variable inside of a string in an update query but seem to be having trouble. I am just now updating all of my old websites to use prepared statements so I am not that familiar with them yet. What do I need to do to get the string and variable connected in the query.
How to get all items that are tagged Tag1 AND Tag2 AND … for a 3-table tag solution
So I implemented a 3 table tag solution, als indicated in this classic post (so-called “Toxi” solution). Everthing works splendid, the only thing I struggle with is to get all items that are …
IlluminateDatabaseQueryException: SQLSTATE[42000]: Syntax error or access violation: 1064
i m trying to add this query into my code in laravel. it runs smoothly in phpmyadmin or with mysql command line but enable to get anything but this syntax error. my query : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for
INSERT INTO – Subquery returns more than 1 row (PHP/MySQL)
I’m trying to develop a website with PHP and MySQL. Here is my PHP code I tried: $sql = sprintf(“INSERT INTO request_boms SET request_list_id = %d, …
How to set pdo timezone at connection
I have this code where I connect to database and the code is working properly. However the now() function of MySQL is out of sync with PHP set default time zone function. I am comparing the PHP date with MySQL now. Therefore, I wanted to set the database time zone as well. I wanted to set the database time upon
Sql query to get row from date filled
I want to get data from training_course table where current date minus 5 days is equal to training_end_date. Training_end_date is my field in the table. Thanks Answer You seem to want: Or, if your dates have time components, you maybe want: