Jump to content

Barand

Moderators
  • Posts

    24,604
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. When you are lost and want directions, it helps if you tell us where you want to go to. Why don't you tell us what you are trying to do. So far you have only told us how you are trying to get there. There could well be a better route. (And perhaps explain what that magical $vehicle object is and where comes from - it just pops up from nowhere in your code)
  2. Probably as much use as Galen is to today's medical practitioners
  3. Good idea. Do you think we should have something like this ?
  4. That line is required (as you have discovered). You need too see if my suspicion is true. If it is, you need to stop it trying to output data for a non-existent product.
  5. LINE 190 $product_info = $this->model_catalog_product->getProduct($product_id); That is where the $product_info gets its value. I suspect that the method getProduct() is returning "false" if the $product_id id invalid (perhaps 0)
  6. I don't know. There's no sign of anything boolean. Did you get the same error messages?
  7. If all you want is a row of date headings and a single row of totals, using PIVOT seems like overkill. <?php $res = $con->query("SELECT pay_date , SUM(amount) as total FROM income GROUP BY pay_date "); $data = $res->fetchAll(); $heads = "<tr><td>" . join('</td><td>', array_column($data, 'pay_date')) . "</td></tr>\n"; $totals = "<tr><td>" . join('</td><td>', array_column($data, 'total')) . "</td></tr>\n"; ?> <table border='1'> <?=$heads?> <?=$totals?> </table>
  8. Have you tried checking the variables a the point where the error occurs. For example var_dump($product_info);
  9. It's a pity you don't have a vehicle table which contains the image url of the vehicle.
  10. Have a try with simple_html_dom class
  11. Stop posting duplicates of this topic.
  12. The solution was to use the correct variable!
  13. How do you expect me to answer questions like that when we don't have clue about what you are really doing. All we have is an abstraction of your problem. I have no idea what "filters" you are applying to other tables in the query. I am talking only about filters tht apply to "order" in this case. I don't know for sure if it is - I can't run your queries and time them - but you can.
  14. Each json message appears to be in a separate row in the table. I don't understand what you mean by "how to separate each json message." Do you mean just adding breaks in the output... $l1 = $con->prepare("SELECT msg, title FROM messages ORDER BY id DESC limit 4"); $l1->execute(); $cntmsg = $l1->rowCount(); foreach($l1 as $r1) { $m1 = $r1['msg']; $someJSON = $m1; $someArray = json_decode($someJSON, true); $pr1 = $someArray["data"]["commsettings"]; foreach($pr1 as $MyIndex => $MyValue) { echo $MyValue["name"] . '<br>'; } echo '<hr>'; } giving
  15. What does this output? echo '<pre>' . print_r($vehicle, 1) . '</pre>';
  16. If you change the query to this $sql = "UPDATE users SET name = :name, email = :email, phone = :phone, address = :address, license_number = :license_number, position = :position, role = :role, submittedby = :submittedby, image = COALESCE(:image, image) WHERE id = :id "; then, if :image is NULL, the existing value will not be changed.
  17. If they are string values, the quotes are necessary. If they are numeric values the quotes shouldn't be there
  18. I'd be inclined to do all the filtering required on the order in the subquery, ensuring there is only one row per order otherwise it throws the pagination. For example, if I only wanted to report orders that had sold widgets or gizmos SELECT o.order_id , customer , p.name , p.quantity FROM ( SELECT DISTINCT o1.order_id , concat(firstname, ' ', lastname) as customer FROM oc_order o1 JOIN oc_order_product op ON o1.order_id = op.order_id AND op.name IN ( 'gizmo' , 'widget' ) ORDER BY order_id LIMIT 0, 2 -- <- paginate here ) o JOIN oc_order_product p USING (order_id); As for relative speeds of alternatives, benchmark them (example).
  19. -> for object properties [] for array keys So $response->data->result[0]->value
  20. Agreed. You do realize that it's objects and not arrays?
  21. What's wrong with using "0"?
  22. $stmt = $db->execute( ... ) should be $stmt->execute( ... )
×
×
  • 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.