Skip to content

Tag: sql

using “INSERT INTO” statement in php code doesn’t work

I’m trying to build a database for a bookstore with 3 tables: Book, Volume and Publication. I’m using mysqli() and the code neither works nor echoes any errors. Answer The problem is that you are checking with === TRUE. As PHP Manual says: Returns FALSE on failure. For successful SELECT, SHOW, DES…

Remove duplicated imported orders in Woocommerce

I have duplicate orders in Woocommerce and I would like to delete them to only keep unique for clean bookkeeping. I am not good at SQL, I wrote this request but it lists both duplicate when there is a duplicate. which gives me 307 results. How can I write the right request to delete the duplicates and only ke…

Select active data by order

I have 2 tables posts and categories, There is one-to-many relation between both tables. Here are the two tables: There is a relation between category_id and c_id, So that the category_id in the posts table refers to the category id c_id. The post_order and c_order are used to order both posts and categories.…

Send PHP Error if No Rows Created

I’m trying to prevent duplicate rows from being created. My current statement works, meaning it prevents duplicates from being created, but it always returns the execution as a success, meaning I don’t get an “error” message if no rows were created. Thanks I would like to fail the sql …