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3 B4 B5 B1 B2 C3 B4 B5 B1 C2 C3 B4 B5 C1 A2 C3 B4 B5 C1 B2 C3 B4 B5 C1 C2 C3 B4 B5 A1 A2 C3 B4 C5 A1 B2 C3 B4 C5 A1 C2 C3 B4 C5 B1 A2 C3 B4 C5 B1 B2 C3 B4 C5 B1 C2 C3 B4 C5 C1 A2 C3 B4 C5 C1 B2 C3 B4 C5 C1 C2 C3 B4 C5 A1 A2 C3 C4 A5 A1 B2 C3 C4 A5 A1 C2 C3 C4 A5 B1 A2 C3 C4 A5 B1 B2 C3 C4 A5 B1 C2 C3 C4 A5 C1 A2 C3 C4 A5 C1 B2 C3 C4 A5 C1 C2 C3 C4 A5 A1 A2 C3 C4 B5 A1 B2 C3 C4 B5 A1 C2 C3 C4 B5 B1 A2 C3 C4 B5 B1 B2 C3 C4 B5 B1 C2 C3 C4 B5 C1 A2 C3 C4 B5 C1 B2 C3 C4 B5 C1 C2 C3 C4 B5 A1 A2 C3 C4 C5 A1 B2 C3 C4 C5 A1 C2 C3 C4 C5 B1 A2 C3 C4 C5 B1 B2 C3 C4 C5 B1 C2 C3 C4 C5 C1 A2 C3 C4 C5 C1 B2 C3 C4 C5 C1 C2 C3 C4 C5
-
That blows your signature's assumption out of the water. The OP didn't claim to processing Amazon ratings but wanted to show ratings a la Amazon
-
Of course it was your response. You posted it. It has your name on it. So given how you obtained the "solution", and knowing is was incorrect, do think that posting an ai-produced, misleading solution was the responsible thing to do?
-
To save time, let's just assume that sometimes you are. Selecting "DISTINCT rating" from the input file created by gizmola will yield 1, 2, 3, 5 as there are no ratings of "4". This was the initial problem and your solution does nothing to solve it. mysql> SELECT ratings.rating, COALESCE(reviews.count, 0) as count FROM ( -> SELECT DISTINCT rating FROM reviews -> ) as ratings -> LEFT JOIN ( -> SELECT rating, COUNT(*) as count FROM reviews GROUP BY rating -> ) as reviews -> ON ratings.rating = reviews.rating; +--------+-------+ | rating | count | +--------+-------+ | 5 | 3 | | 2 | 2 | | 3 | 2 | | 1 | 2 | +--------+-------+
-
My IDE is Nusphere PhpEd Pro. I used its "Show file differences" facility.
-
Some dodgy html markup in that line.
-
These are the differences I can see Your "after" file has a comma at the end of line 1, the "before" one doesn't. Your "after" file has a newline character at the end of the final line (extra blank line at end of file); "before" doesn't. "After" prices not rounded to 2 dec; "before" ones are. (123.50 becomes 123.5 etc)
-
Have you tried comparing your file with one you get from Excel to see if there are differences that would account for its acceptance?
-
Hey moderators question for you
Barand replied to PNewCode's topic in PHPFreaks.com Website Feedback
There is a "Job Offerings" forum on this site in the "Freelance, Contracts, Employment Etc" section. Post what you want doing and your contact details. -
Yes it will - concatenation is being used. If, however, it is html code and not something being echoed then it needs to be <div class="modal-body"> <?= $row['bio'] ?> </div>
-
Create a "valid_ratings" table in your DB containg a row for each valid rating (1-5). Useful for creating dropdowns or radio button lists for the user to choose from. If you don't want to this, you can create it as a temporary table when you want thse totals # # Additional valid ratings table # $pdo->exec("create temporary table valid_rating (rating int unsigned not null primary key)"); $pdo->exec("insert into valid_rating values (1), (2), (3), (4), (5)"); # # get ratings totals # $res = $pdo->query("SELECT v.rating , count(r.id) as total FROM valid_rating v LEFT JOIN reviews r USING (rating) GROUP BY rating; "); printf("<pre>\n| Rating | Total |\n\n"); foreach ($res as $r) { printf("| %6d | %5d |\n", $r['rating'], $r['total']); } | Rating | Total | | 1 | 2 | | 2 | 2 | | 3 | 2 | | 4 | 0 | | 5 | 3 | An alternative solution is the one @gizmola alluded to $results = array_fill_keys(range(1,5), 0); // create array with 0 total for all possible ratings $res = $pdo->query("SELECT rating , count(*) as total FROM reviews GROUP BY rating "); foreach ($res as $r) { $results[$r['rating']] = $r['total']; // put totals from query into the array } printf("<pre>\n| Rating | Total |\n\n"); foreach ($results as $rating => $total) { printf("| %6d | %5d |\n", $rating, $total); }
-
Isn't that what the third line of your code is doing?
-
The point is that that your code to set the error reporting level is not being executed. When you run a PHP script is is first parsed for errors (startup errors). If none are found the script is then executed (and your error reporting code will be executed) but, as in this case, if errors are found your code is not executed. This was pointed out to you by requinix earlier...
-
Have you checked the content of the $_POST array? Have you checked if any data been posted to that page?
-
Did you try the alternative that I added?
-
But it isn't a fatal error, just a warning. echo "Version " . phpversion() . '<br><br>'; $keys = ['HTTP_USER_AGENT', 'HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_ACCEPT_CHARSET']; foreach ($keys as $k) { echo "<b>$k</b> <br> {$_SERVER[$k]} <br><br>"; } Outputs ... Further, using the "@" suppresses the warning as expected when I run the OP's code PS An alternative to using the "@" could be $keys = ['HTTP_USER_AGENT', 'HTTP_ACCEPT', 'HTTP_ACCEPT_LANGUAGE', 'HTTP_ACCEPT_CHARSET']; $sig = ''; foreach ($keys as $k) { $sig .= $_SERVER[$k] ?? ''; }
-
-
Hve you tried using the CSS line-height property?
-
HTML ignore whitespace. Try .text() instead of .html(). Or substitute <br> for \r
-
Just run a couple of queries to find those that occur more than once SELECT username , COUNT(*) as tot FROM photos GROUP BY username HAVING tot > 1; SELECT email , COUNT(*) as tot FROM photos GROUP BY email HAVING tot > 1; Once you've eliminated the dupes already there you can set up the DUPLICATE constraints.
-
Smarty template & PHP 8.1, TEXT: Function strftime() is deprecated
Barand replied to ohno's topic in PHP Coding Help
You can't put an ini_set statement in the ini file. It should look like thisin the ini file... display_startup_errors = On Search you php.ini file for that setting and change it to "On" -
Smarty template & PHP 8.1, TEXT: Function strftime() is deprecated
Barand replied to ohno's topic in PHP Coding Help
That doesn't set display_Startup_errors to ON, it only sets the error levels. -
Smarty template & PHP 8.1, TEXT: Function strftime() is deprecated
Barand replied to ohno's topic in PHP Coding Help
If there are startup errors the script doesn't run. If the script doesn't run the ini_set() can't be executed. You need those settings to be in your php.ini file. -
This code $names = [ 'prancer', 'dancer', 'dasher', 'vixen', 'comet', 'cupid', 'donner', 'blitzen' ]; unset($names[5]); for ($i=0; $i<count($names); $i++) { echo $names[$i] . '<br>'; } gives the following output, and is similar to what you are doing prancer dancer dasher vixen comet Warning: Undefined array key 5 in C:\inetpub\wwwroot\apps\olumide\noname5.php on line 16 When you use a for loop like that it assumes all keys from 0 to 7 will be present, but '5' was unset and no longer exists. Use foreach () when looping through arrays.
-