First a bit of background about the tables & DB. I have a MySQL db with a few tables in: films: Contains all film/series info with netflixid as a unique primary key. users: Contains user info “ratingid” is a unique primary key rating: Contains ALL user rating info, netflixid and a unique primary key of a compound “netflixid-userid” This statement
Tag: sql
How can I use mysqli to SELECT and both DELETE and RETURN a single row based on WHERE condition
How can I do a mysqli php query so a SELECT request both RETURNS the row AND DELETES the same row in the MySQL DB? This php script works fine to query and return a single row based on max numerical zipcode (an example) but my modifications do not complete the delete row: I tried adding this line in various
Looping to find nearly matching file names separated by a few seconds
I’m quite new to SQL and my database design is probably quite poor, however I would appreciate some help attempting to match files. The Project: A video camera records an image file and video file …
PHP looping over data and getting key/value pairs
I’m using Laravel 8 to loop over some data. I’ve got my data out from my database, but am struggling to loop over the data in a foreach loop, it doesn’t appear to be giving me the key/value pairs, only the index/value pair? But if I var_dump() my $applicationOptions I can see the array inside of the attributes and the
updating blade view everytime theres an update in the the database table
I have a stat bar on my blade, which for example says ‘Calls Today : 0’ etc, I need for the the stats to update each time theres an update in the sql database for calls today. so for example if calls Today goes up to 5 in the database, the blade views Calls Today must also go up to
Unexpected SELECT output from SQLite
5 mins ago was testing a query against SQLite database and got the following issue with < operator. Here's the info: [Table schema] CREATE TABLE products ( name TEXT, number TEXT, …
Mysql statement where not exists with time intervals
I am basically trying to get my app to report when items are not returned or overdue in a 5 day and 15 day window. After much trial and error the below coded is the best I could come up with. However, …
get users that did not buy a product
I have three tables users table products table users_buy table I want to get users who did not buy a specific product for example, user number 20 bought 5 product with ids [1,2,3,4,5] and user number 19 bought 3 product with ids [1,2,3] And user number 18 bought 2 product with ids [1,3] I want to get users who did
ON DUPLICATE KEY UPDATE in oracle or equiv (defining key/column?)
I have the below working insert statement, where I am essentially mapping the column data from an uploaded .csv file through a loop into my VALUES variables below… All worked fine, except now I am just trying to add a tweak INSERT or UPDATE – if ‘app_id’ first column, value is found in the uploaded .csv, i.e. duplicate is found
SQL not Inserting using PHP
I have the following code sending data from a form to an SQL database: My database table is structured as with studentID being a primary key auto incrementing and all fields apart from dob as text (dob is set as datetime) The form which is sending the data looks like this: I’m not getting a PDO error but the data