Posts

Showing posts with the label mysqli

SQL Query for find the decade with the largest number of records

Image
Clash Royale CLAN TAG #URR8PPP SQL Query for find the decade with the largest number of records I have a database including the following tables: ACTOR (id, fname, lname, gender) MOVIE (id, name, year, rank) DIRECTOR (id, fname, lname) CAST (a_id, m_id, role) MOVIE_DIRECTOR (d_id, m_id) Now I want to retrieve the data of the following question. Ques: "A decade is a sequence of 10 consecutive years. For example, 1965, 1966, ..., 1974 is a decade, and so is 1967, 1968, ..., 1976. Find the decade with the largest number of films" Homework? What have you tried? – JimmyB 2 hours ago Hint: Every movie can be seen to be the beginning of a decade. Then, the decade are all years between this movie's year and the movie's year+10. – JimmyB 2 hours ago ...

mysqli_query single query gerenating PHP fatal error: Allowed memory size exhausted

Image
Clash Royale CLAN TAG #URR8PPP mysqli_query single query gerenating PHP fatal error: Allowed memory size exhausted I have a Mysql table (named "base") with 3 million records , which is composed of only 3 int(10) fields . When I try to run this simple query $result = mysqli_query($db, 'SELECT * FROM base') , php shows the error: $result = mysqli_query($db, 'SELECT * FROM base') PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485768 bytes) in C:xampphtdocscombina.php on line 17 PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485768 bytes) in C:xampphtdocscombina.php on line 17 I think mysqli_query should not load all the table records into memory, right? So why the memory overflow? I'm using XAMPP installation on Windows 10, PHP 7.2. Here is the code: $servername = "localhost"; $ult_elemsername = "root"; $password = ""; $dbname = "comb"; $d...