-
Posts
24,606 -
Joined
-
Last visited
-
Days Won
831
Everything posted by Barand
-
try SELECT mot , COUNT(*) as nmbr , GROUP_CONCAT(pseudo ORDER BY pseudo SEPARATOR ', ') as players FROM unanimo GROUP BY mot HAVING nmbr > 1 ORDER BY nmbr DESC; +--------+------+-------------------+ | mot | nmbr | players | +--------+------+-------------------+ | beetle | 3 | Mary, Paul, Peter | | spider | 3 | Mary, Paul, Peter | | animal | 3 | Mary, Paul, Peter | | bird | 2 | Mary, Paul | | bug | 2 | Mary, Peter | | cow | 2 | Mary, Paul | | dog | 2 | Mary, Paul | +--------+------+-------------------+
-
Cumulative sum in MySQL View (calculating running profit/loss)
Barand replied to DariusB's topic in MySQL Help
try SELECT country ,Competition ,match_date ,ko_time ,home ,away ,Result ,Profit ,cum_profit FROM mecze INNER JOIN ( SELECT id , @cum:=@cum+profit as cum_profit FROM mecze JOIN (SELECT @cum:=0) init ORDER BY ko_time, id ) cum USING (id) ORDER BY ko_time DESC, id DESC; +---------+----------------+------------+----------+--------+--------------+--------+--------+------------+ | country | Competition | match_date | ko_time | home | away | Result | Profit | cum_profit | +---------+----------------+------------+----------+--------+--------------+--------+--------+------------+ | Europe | Europa League | 2015-11-05 | 20:05:00 | Sparta | Schalke | L | -10 | -12 | | Denmark | Superliga | 2015-11-05 | 18:00:00 | Aarhus | Sonderjyske | L | -10 | -2 | | Europe | Europa League | 2015-11-05 | 18:00:00 | Plzen | Rapid Vienna | W | 10 | 8 | | Europe | Europa League | 2015-11-05 | 18:00:00 | Celtic | Molde | W | 8 | -2 | | Bahrain | Premier League | 2015-11-05 | 15:00:00 | Manama | East Riffa | L | -10 | -10 | +---------+----------------+------------+----------+--------+--------------+--------+--------+------------+ -
this query should calculate the scores for you SELECT pseudo , SUM(nmbr) as score FROM unanimo INNER JOIN ( SELECT mot , COUNT(*) as nmbr FROM unanimo GROUP BY mot HAVING nmbr > 1 ) tot USING (mot) GROUP BY pseudo ORDER BY score DESC; Data and results
-
Use password_hash() and password_verify(). http://php.net/manual/en/function.password-hash.php (You may find the notes on that page useful if you are not yet on PHP5.5+)
-
Yes. But unlink() is a function, not a variable.
-
Is it something simple like that page is missing the session_start() call at the beginning of the script?
-
Don't put FiscalYear condition in the WHERE clause, put it in the table join condition LEFT JOIN eventtbl e ON c.cid = e.cid AND e.FiscalYear = 'FY16'
-
BTW, "dog"=<"Image/Dog.jpg" should be "dog"=>"Image/Dog.jpg"
-
Skip first line on import csv using php mysqli
Barand replied to samuel_lopez's topic in PHP Coding Help
You could check if the age value is numeric. If it isn't (header), skip the insert. -
Exclude dates that you don't want to display in the original query. Don't select them then hide them.
-
You said that "CNT_TXT_WARNING_EMAILSENTOK" is defined in a text file. How do you get it from said text file to that script?
-
Can php do two execute (queries) in same time?
Barand replied to sigmahokies's topic in PHP Coding Help
It worked well enough for me to produce that output. You may have to make one or two minor tweaks to adapt it to your database and table. -
Can php do two execute (queries) in same time?
Barand replied to sigmahokies's topic in PHP Coding Help
I already gave you the code that produced that output. How much more help do you need? -
Can php do two execute (queries) in same time?
Barand replied to sigmahokies's topic in PHP Coding Help
-
Do have CNT_TXT_WARNING_EMAILSENTOK defined anywhere, for example define("CNT_TXT_WARNING_EMAILSENTOK", "This is a message to say it is OK");
-
Your implementation is nothing like my example. The STR_TO_DATE() in my example is in the VALUES(..) part, you have just added in the columns part.
-
You need to put dates into the database in yyyy-mm-dd format so if your datepicker is using dd/mm/yy then the date needs converting. You can do this in SQL with the method shown in this example INSERT INTO table (mydate) VALUES (STR_TO_DATE($datepickerdate, '%d/%m/%y') )
-
Show roulette from start and not just when start spin
Barand replied to Robban's topic in Javascript Help
Moving to AJAX forum -
You need to concatenate header("Location:../presupuesto.php?msg=" . CNT_TXT_WARNING_EMAILSENTO);
-
row is an object but row.id_itens isn't. You could have just done this (without the stringify) $('#myModal').modal('show').find('.modal-body #id_itens').val(row.id_itens);
-
Unless it's an object or an array there is no need to stringify.
-
Images have a carriage return at the start of the file
Barand replied to MarkyA's topic in Applications
Don't put the closing ?> at the end of included files. -
I see you bind the value with "PDO::PARAM_STR" yet your data (6 and 11) are numeric, How is id_itens defined?
-
Are you sure the spelling is correct? $sql = 'DELETE FROM `item` WHERE `id_itens`=:me';
-
Why are you preparing, binding then executing the query twice? That will write each record twice to the table.