Jump to content

Barand

Moderators
  • Posts

    24,602
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. If they were empty, var_dump would show string(0) "" try echo bin2hex($exif1['GPS']['GPSAltitureRef']);
  2. Where you have a function that desn't return a value (referred to in some languages as a void function and in other languages as a procedure) then, I agree, a return on the last line is pointless as it exits the function anyway. For functions that return a value, a return is necessary, and usually on the last line, although not necessarily. Another debugging tip... When outputting to the screen normally, use "echo" When outputting variables for debug puposes only, use "print". This makes it easy to search and remove stuff that shouldn't be in the production version.
  3. I wouldn't split the clients into vendor and client tables - just have a client table. In one transaction, A might be the seller but in another transaction A might be the buyer (as in the examples in your initial post). Just record the buyer and seller ids in each sale transaction. Don't store derived data, such as total paid, balance outstanding etc. You get those by querying the transactions and payments.
  4. Your items table may be a headache. Vendor B sells bikes and the item attributes are Now what if vendor D sells fridge/freezers whose attributes are width, height, depth, colour, fridge capacity, freezer capacity, ice dispenser(Y/N) and vendor E is selling concert tickets?
  5. That query is looking at March to May only, so that needs changing. Also it looks for those who paid; you now want those who didin't pay. In addition, you are looking for any occurence, not when there are 3.
  6. If it helps, note that that a <button> element can have a value attribute independent of its label <?php $option = $_GET['option'] ?? ''; if ($option) echo "You chose $option<hr>"; ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Sample</title> </head> <body> <form> Select an option <button name="option" value="1">Choose me</button> <button name="option" value="2">Choose me</button> <button name="option" value="3">No, Choose me</button> <button name="option" value="4">No, Choose me</button> <button name="option" value="5">No, Choose me</button> </form> </body> </html>
  7. when $ret > 0 you get sent to dashboard. It will not get as far the 3rd condition. Once on elseif condition is satisfied it stops processing them. BTW, you should always have an exit instruction after a header("location ...");
  8. With mysqli, when you use prepare() you get a statement object. The fetch_all() method you are using is a mysqli result object method (You get a result object when you use mysqli query() ). mysqli was built by two teams of developers who never spoke to one another, and so you get one set of methods for statements and a completely different set for results. Use PDO and this mess goes away.
  9. try $temp = []; foreach ($cars as $car) { $qty = intval($car); $key = trim(strstr($car, ','), ','); if (!isset($temp[$key])) $temp[$key] = 0; $temp[$key] += $qty; } foreach ($temp as $k => $t) { $newcars[] = "$t,$k"; }
  10. Given that your form would look something like this your cars array would be an array of string values and not an array of arrays as you posted., IE $cars = [ 0 => "1,'BMW',15,13", 1 => "8,'BMW',15,13", 2 => "3,'Saab',5,2", 3 => "3,930,2,8", 4 => "6,370,7,1" ]; unless you are doing further processing to creat the posted array
  11. Going back a step, how are you creating that original array?
  12. All you should be sending to the cart is product id and quantity. Never allow the user the specify their own price, otherwise you'll end up selling everything for 0.01. On the cart page, query the database to get price and description.
  13. Is it objecting to the missing "$return" parameter? try $CI->db =& DB($params, false, $active_record);
  14. A couple of caveats for the record... 1 ) 2020-01-01, without the quotes, evaluates to 2018 (2020 minus 1 minus 1) but I'm sure it was just a typo in this instance. 2 ) if dateinfo is a datetime type then you need to make sure you use only its date portion when comparing against '2020-07-19' (which is actually '2020-07-19 00:00:00'). If datainfo were to contain '2020-07-19 01:00:00' then it would be outside the range if you don't compare DATE(dateinfo)
  15. You don't put them in the same column, you put them in separate rows in a second table
  16. Set the values in the php.ini file instead of using ini_set() all the time. That's what it's for. If you have a startup error the code won't even execute, so not of those ini_set()s can happen. Therefore ini_set('dispay_startup_errors', 1) is as much use as a chocolate teapot.
  17. The user doesn't input the value on checkboxes or radio buttons <button>s are just another type of html element which allow the programmer to set a value independent of its label. In the example below, the value of the clicked button would be sent in $_POST['gender'] <button name='gender' value='M'>Male</button> <button name='gender' value='F'>Female</button>
  18. Your $_POST values do not match what is posted. Try a very simple piece of code from "Debugging 101" echo '<pre>' . print_r($_POST, 1) . '</pre>'; so you can see what is being posted
  19. Where to start? If those fields (page_url, link_anchor_text etc) all exist in the form then after the form is posted all those POSTed values will be set. In particular, $_POST['page_url'] will be set so no others will be checked. If $_POST['page_url'] is empty then your SESSION variable will be empty. It needs to contain a valid column name, hence your sql error. You need to be setting the SESSION value to column name, not the content of the form field.
  20. Which of those 34 lines is line 97?
  21. By referencing the file system path to the file or by defining an included files folder in your php.ini file.
  22. Yeah, must be tough. I was only in my 50s when I started learning PHP.
  23. Post the code that's giving the problem. We are not clairvoyant.
  24. You have a couple of options 1 ) Re-format the date in the SQL query when you retrieve the records. EG SELECT DATE_FORMAT(invoice_date_created, '%d.%m.%Y') as invoice_date_created 2 ) Re-format after retrieval in the array $transaction['invoice_date_created'] = date('d.m.Y', strtotime($transaction['invoice_date_created']));
  25. Not quite. var_dump($delta) gives float(0), therefore the first branch needs to be either if ($delta === 0.0) { or if ($delta == 0) {
×
×
  • 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.