Jump to content

Barand

Moderators
  • Posts

    24,609
  • Joined

  • Last visited

  • Days Won

    831

Everything posted by Barand

  1. Do you still get that notice if you enter a valid id?
  2. Instead of using hyphens, use array indices in your form input field names <input type="text" name="guestname[0]" > <input type="text" name="guestname[1]" >
  3. If you use an aggregation function (SUM, COUNT, AVG etc) without a GROUP BY clause you get a single aggregation (row) for the whole table. Don't use "SELECT * ", especially with aggregations. Don't run queries inside loops. Get the data you need with a single query Don't litter the forum with multiple threads on the same topic. From your earlier post it looked like you want the average daily total for each month SELECT YEAR(day) as yr , MONTH(day) as mth , AVG(price) as avprice FROM ( SELECT DATE(order_datetime) as day , SUM(purchase_price) as price FROM ordered_items WHERE YEAR(order_datetime) = YEAR(CURDATE()) AND order_status = 5 GROUP BY day ) daily GROUP BY yr, mth;
  4. See https://www.php.net/manual/en/language.variables.external.php
  5. DOH! 🙄 Forgot to include the flat charge in the spreadsheet total formula (copied the "Units" total formula) and also completely missed the VAT element. Thus demonstrating the perils of copy/paste - a warning to all.
  6. Sorry, don't know a solution that will give you 914.01.
  7. You don't say what the problem is, but WHERE username = !null - WRONG WHERE username IS NOT NULL - CORRECT;
  8. Aside from that, mysql will only report that the combination of username, password and domain was invalid, not which portions.
  9. How to help your local neighbourhood hacker - let them know whether it was the username or the password that they got wrong. At least then they know they are half-way there.
  10. Remind me - what's that saying about a workman and his tools?
  11. That line is a waste of time. If you have startup errors the code isn't going to run to execute it. Error handling should be set in the php.ini file, not in every script.
  12. The key names there - you just have to use it. $myArray = array(); $myArray[0]['Name'] = 'fred'; $myArray[0]['Age'] = 55; $myArray[1]['Name'] = 'Joe'; $myArray[1]['Age']= 765; echo '<pre>', print_r($myArray, 1), '</pre>'; foreach ($myArray as $key => $value): echo "<br><b>Person $key:</b><br>"; foreach ($value as $k => $v) { echo " &bull; $k : $v<br>"; } endforeach; Outputs Array ( [0] => Array ( [Name] => fred [Age] => 55 ) [1] => Array ( [Name] => Joe [Age] => 765 ) ) Person 0: • Name : fred • Age : 55 Person 1: • Name : Joe • Age : 765
  13. The usual method for processing an array is with "foreach" which gets you the key and value on each iteration foreach ($myArray[$i] as $key => $value) { if isInvalid($key, $value) { report($key); } }
  14. You need to provide context details and a better explanation than that if you want any meaningful replies.
  15. F***ed Up Beyond All Recognition. I think it's an army acronym, like SNAFU(Situation Normal, All F***ed Up)
  16. I still don't understand the process going on here but the feel of that table is wrong - it has a distinct unnormalized aroma about it, as though it should be 2 tables without triple keys..
  17. What are these fields? `original_request_id` int(11) NOT NULL, `ref_request_id` int(11) DEFAULT NULL,
  18. All that line does in your ajax script is send the name of the file. It is NOT uploading the file. https://www.php.net/manual/en/features.file-upload.php
  19. Show us your table definition.
  20. PHP isn't the only language ot there, and compiled code would be very difficult to spot.
  21. Example <div> <img class='product-img' src='images/mac128.jpg' ></div> <div class='overlay'>Pre Order</br>NOW</div> CSS <style type='text/css'> .overlay { width: 60px; height: 60px; padding-top: 20px; border-radius: 50%; font-size: 8px; text-align: center; background-color: #E02222; color: #FFF; position: relative; top: -70px; left: 10px; z-index: 5; } </style> Result
  22. Does $_FILES['photo']['error'] give any clues?
  23. You are creating an XML document in $doc, then right at the end, you decide to reference it as $xml instead of $doc.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.