Jump to content

Barand

Moderators
  • Posts

    24,563
  • Joined

  • Last visited

  • Days Won

    822

Everything posted by Barand

  1. Shouldn't give that error then. It should just give a zero price because none of the booked query room ids are that empty array. Are you sure it's not being overwritten anywhere?
  2. If you have no reserved rooms, how is $reservedrooms defined in your script;. Are you initially defining it as an empty string $reservedrooms = ""; or an empty array $reservedrooms = [];
  3. What happens if you get the val() of the enclosing <select> element?
  4. Your earlier query checks for the existence of id = $_GET['decs_id']. Do not want to update that record?
  5. Check the value of $_GET['id'] when you attempt the update. Why are you updating the clientid?
  6. Do you have error display set and have you set the PDO error mode attrubute when connecting? eg $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  7. What happens if you move the status condition to the outer where clause with the site condition?
  8. Neither do we. We cannot see over shoulder from this distance to see what your code looks like.
  9. Alternatively $bookquery = array_filter($bookquery, fn($v)=>in_array($v['room_id'], $reservedrooms)); $totalprice = array_sum(array_column($bookquery, 'price'));
  10. Your data probably looks something like this $reservedrooms = [2, 4, 6]; $bookquery = [ 0 => ['room_id' => 2, 'price' => '125' ], 1 => ['room_id' => 3, 'price' => '125' ], 2 => ['room_id' => 4, 'price' => '125' ], 3 => ['room_id' => 5, 'price' => '125' ] ]; You can get an array of room ids from $bookquery in same format as $reserved rooms with $queryrooms = array_column($bookquery, 'room_id')
  11. I guess I'll have to take your word for that.
  12. You need to join to the other tables to add that.
  13. P.S. I forgot to explain that values in any columns that aren't aggregated (SUM, COUNT, MAX etc) or in the GROUP BY clause can come from any arbitrary record in the group (usually the first but no guarantees what the first will be without an ORDER BY.
  14. Just using the single available table here... SELECT dr.id , device_id , status_id , action_time FROM deployment_register dr JOIN ( SELECT device_id , MAX(action_time) as action_time FROM deployment_register WHERE status_id IN (2, 5) GROUP BY device_id ) latest USING (device_id, action_time); +----+-----------+-----------+---------------------+ | id | device_id | status_id | action_time | +----+-----------+-----------+---------------------+ | 7 | 3 | 5 | 2023-10-07 21:06:45 | +----+-----------+-----------+---------------------+ Subquery to find latest row for each device then join against that.
  15. Are you saying you want the data for the latest row in the deployment_register table?
  16. Good luck trying to get someone to earn your qualification for you. However, if you are trying and are stuck on some particular aspect then give details and show us what you have tried so far.
  17. No, I wanted to see the contents too so I could see how the data was being stored (significant, as the example below shows), hence the request for a dump and not structure. mysql> SELECT * FROM calibrationdata LIMIT 1\G *************************** 1. row *************************** id: 5800 Branch: Hyderabad Custname: XXXXXX Enterprises Limited Siteaddress: XXX XXXXXX, Survey no 296/7/9 , Hyderabad, Telangana Officeaddress: XXX XXXXXX, Survey no 296/7/9 , Hyderabad, Telangana Model: M1C PlantSno: 377 Inchargename: Mr. Jaleel XXXXXX Mobileno: XXXXXXX665 Emailid: xxxxxx@xxxxxxxxxxxxxxxxx.com Date: 2023-09-25 SEnggname: xxxxxx xxxxxx xxxxxx pmname: Mr. Jaleel xxxxxx pmdesig: Incharge pmcompany: XXXXXX Enterprises ltd QCname: XXXXXX QCdesig: Incharge QCcompany: XXXXXX Enterprises ltd client1name: client1desig: client1company: client2name: client2desig: client2company: Aggmax: 2000 Cemmax: 600 Watermax: 300 CemWtrmax: Admix1max: 6000 Admix2max: Silicamax: Icemax: Callno: SE230925361715 Calltype: non - warranty status: 1 aggregateascending: {"val_0":"0,0,0","val_1":"100,101,1","val_2":"200,202,2","val_3":"300,301,1","val_4":"400,401,1","val_5":"500,501,1","val_6":"600,602,2","val_7":"700,701,1","val_8":"800,802,2","val_9":"900,903,3","val_10":"1000,1001,1","val_11":"1100,1101,1","val_12":"1200,1201,1","val_13":"1300,1302,2","val_14":"1400,1402,2","val_15":"1500,1502,2","val_16":"1600,1602,2","val_17":"1700,1702,2","val_18":"1800,1802,2","val_19":"1900,1902,2","val_20":"2000,2002,2"} aggregatedescending: {"val_0":"2000,2002,2","val_1":"1900,1902,2","val_2":"1800,1802,2","val_3":"1700,1702,2","val_4":"1600,1602,2","val_5":"1500,1502,2","val_6":"1400,1402,2","val_7":"1300,1302,2","val_8":"1200,1202,2","val_9":"1100,1102,2","val_10":"1000,1001,1","val_11":"900,901,1","val_12":"800,801,1","val_13":"700,701,1","val_14":"600,601,1","val_15":"500,501,1","val_16":"400,401,1","val_17":"300,301,1","val_18":"200,201,1","val_19":"100,101,1","val_20":"0,1,1"} cementascending: {"val_0":"0,0,0","val_1":"20,19,-1","val_2":"40,39,-1","val_3":"60,59,-1","val_4":"80,80,0","val_5":"100,99,-1","val_6":"120,119,-1","val_7":"140,139,-1","val_8":"160,159,-1","val_9":"180,179,-1","val_10":"200,199,-1","val_11":"220,221,1","val_12":"240,241,1","val_13":"260,261,1","val_14":"280,281,1","val_15":"300,301,1","val_16":"320,321,1","val_17":"340,341,1","val_18":"360,361,1","val_19":"380,381,1","val_20":"400,401,1","val_21":"420,421,1","val_22":"440,441,1","val_23":"460,461,1","val_24":"480,481,1","val_25":"500,501,1","val_26":"520,521,1","val_27":"540,541,1","val_28":"560,561,1","val_29":"580,581,1","val_30":"600,601,1"} cementdescending: {"val_0":"600,601,1","val_1":"580,581,1","val_2":"560,561,1","val_3":"540,541,1","val_4":"520,521,1","val_5":"500,501,1","val_6":"480,481,1","val_7":"460,461,1","val_8":"440,441,1","val_9":"420,421,1","val_10":"400,401,1","val_11":"380,381,1","val_12":"360,361,1","val_13":"340,341,1","val_14":"320,321,1","val_15":"300,301,1","val_16":"280,281,1","val_17":"260,259,-1","val_18":"240,239,-1","val_19":"220,219,-1","val_20":"200,199,-1","val_21":"180,181,1","val_22":"160,161,1","val_23":"140,141,1","val_24":"120,121,1","val_25":"100,101,1","val_26":"80,81,1","val_27":"60,61,1","val_28":"40,41,1","val_29":"20,21,1","val_30":"0,1,1"} waterascending: {"val_0":"0,0,0","val_1":"20,20,0","val_2":"40,40,0","val_3":"60,60,0","val_4":"80,80,0","val_5":"100,100,0","val_6":"120,120,0","val_7":"140,140,0","val_8":"160,160,0","val_9":"180,180,0","val_10":"200,200,0","val_11":"220,220,0","val_12":"240,240,0","val_13":"260,260,0","val_14":"280,280,0","val_15":"300,300,0"} waterdescending: {"val_0":"300,300,0","val_1":"280,280,0","val_2":"260,260,0","val_3":"240,240,0","val_4":"220,220,0","val_5":"200,200,0","val_6":"180,180,0","val_7":"160,160,0","val_8":"140,140,0","val_9":"120,120,0","val_10":"100,100,0","val_11":"80,80,0","val_12":"60,60,0","val_13":"40,40,0","val_14":"20,20,0","val_15":"0,0,0"} cementwaterascending: {} cementwaterdescending: {} admixtureascending: {"val_0":"0,0,0","val_1":"1000,1002,2","val_2":"2000,2003,3","val_3":"3000,3002,2","val_4":"4000,4002,2","val_5":"5000,5003,3","val_6":"6000,6002,2"} admixturedescending: {"val_0":"6000,6003,3","val_1":"5000,5002,2","val_2":"4000,4002,2","val_3":"3000,3003,3","val_4":"2000,2002,2","val_5":"1000,1002,2","val_6":"0,2,2"} admixture2ascending: {} admixture2descending: {} silicaascending: {} silicadescending: {} iceascending: {} icedescending: {} invoiceno: 86431240 amount: 9440 enable: First: 0000-00-00 Second: 0000-00-00 Third: 0000-00-00 client3name: client3desig: client3company: today: 2023-09-25 Tolerance: 0
  18. 1700 lines of repetative code and and yet another spreadsheet posing as a DB table doesn't make for an instant fix. FYI : The best way to stop me working on your problem is to badger me about it - I am not on your payroll.
  19. http://barringtondrew.co.uk/?page=3&tut=1
  20. Your code only seems to need two tables userdetails calibrationdata Can you provide a dump of just those?
  21. What does it do when you try it?
  22. FYI - jquery makes it easier... let w1 = $("#dotBorder").css("width"))
  23. or.. <?php if ($_SERVER['REQUEST_METHOD']=='POST') { echo $_POST['btnSub']; //==> Select/Activate } ?> <form method = "post" > <input type = "submit" name = "btnSub" value = "Select" id = "zz"> <input type = "submit" name = "btnSub" value = "Activate" id = "qq"> </form>
  24. Your image buttons don't specify image sources
  25. Your query gets the room_id - use it. Then <script type='text/javascript'> function myFunction(n) { var popup = document.getElementById("myPopup"+n); if (popup.style.display == "block") { popup.style.display = "none" } else { popup.style.display = "block" } } </script>
×
×
  • 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.