[Solved] mysql rows count by where clause

Try using this query – $query = mysqli_query(“SELECT subcommentid,COUNT(*) as count FROM table GROUP BY subcommentid ORDER BY count DESC;”); $result = mysqli_fetch_array($query); echo $result[‘subcommentid’].'<br/>’; //subcomment id echo $result[‘count’]; // number of rows If you want all, store in array – $results = array(); while($row = mysqli_fetch_array($query)) { $results[$row[‘subcommentid’]] = $row[‘count’]; } echo “<pre>”;print_r($results);exit; 2 … Read more

[Solved] Select all rows but one [closed]

Use <> or != as an not equal to operator. SELECT * FROM member WHERE personID <> 123; SELECT * FROM member WHERE personID != 123; If you want to exclude multiple IDs: SELECT * FROM member WHERE personID NOT IN (1,2,3); 4 solved Select all rows but one [closed]

[Solved] SQL plages de dates [closed]

For each operator (ie < or > ) there must be a distinct right and left side. When you write datedebut < 20181109 < datefin it is parsed as datedebut < 20181109 and the result of that comparison is sent to the next operator. You need to think differently when writing SQL than when writing … Read more

[Solved] what does mean this code in c sharp c# [closed]

I’m guessing you’re getting something along the lines of “there is already an open reader associated with the current connection”, yes? If so, see the second part of the answer. this what i dont understand CustomerDS custDB = new CustomerDS(); custDB.Clear(); adap.Fill(custDB, “Customers”); The first line is trivial, and simply creates a new empty instance … Read more

[Solved] Search engine PHP return error [closed]

On line 33 you have $i++, but you haven’t initialised $i I expect you have a syntax error in your MySQL query. Try this: $query1 = mysql_query($query) or die(mysql_error()); which will display the SQL error which you’ll have to fix. More: Your SQL is susceptible to an injection attack. Make sure you escape your inputs … Read more

[Solved] PDOException SQLSTATE[HY000] [2002] No such file or directory

The error message indicates that a MySQL connection via socket is tried (which is not supported). In the context of Laravel (artisan), you probably want to use a different / the correct environment. Eg: php artisan migrate –env=production (or whatever environment). See here. 5 solved PDOException SQLSTATE[HY000] [2002] No such file or directory

[Solved] How to count products to multiple filters

For example if this is frontend and their are checkboxes and their are UNchecked atm Size (group_id) 10m (option_id: 52) (21 products) 20m (option_id: 51) (1 product) Color (group_id) Green (option_id: 49) (22 products) Black (option_id: 38) (1 product) SELECT COUNT(DISTINCT CASE WHEN option_id = 52 THEN product_id END) p52, COUNT(DISTINCT CASE WHEN option_id = … Read more

[Solved] How to add date to MySQL table name? [closed]

1st create archive database (vervanger_archive) . 2nd at original base if you dont have set DATE_ADD (adding timestamp for each row). 3rd SET 1 cron task once upon a day to move OLD rows from Original table to the archive table. Creating tables with timestamp names is bad choice.. 1 solved How to add date … Read more