Jump to content

Barand

Moderators
  • Posts

    24,345
  • Joined

  • Last visited

  • Days Won

    795

Everything posted by Barand

  1. After the mysqli_query line, add if (!$res) echo $con->error; That should tell you why.
  2. IDs have to be unique within a document. If you have multiple objects, use classname instead.
  3. here's mine, with the data you sent weirdsort.php
  4. how's this? usort($data, function($a,$b) { list($a1,$a2,$a3) = splitParts($a); list($b1,$b2,$b3) = splitParts($b); $x = strcmp($a1,$b1); if ($x == 0) { $y = $b2 - $a2; if ($y == 0) { return $b3 - $a3; } return $y; } return $x; }); function splitParts($s) { $k = strlen($s); $a = ['','','']; $i = 0; $p = 0; while ($i < $k) { $c = $s[$i++]; if (ctype_digit($c) && $p==0) $p = 1; if ($c=='-') { $c = $s[$i++]; ++$p; } $a[$p] .= $c; } return $a; }
  5. Thanks, saves a lot of editing Now which bits are ascending and which are descending in the required sort?
  6. More generalized case $x=1; $y=111; $z = $x + $y/pow(10,strlen($y));
  7. As this is a math help forum $x=1; $y=1; $z = $x + $y/10; echo $z;
  8. Post the array again using the output from var_export($array); That gives us processable code. AAA XXXX YYYY - which bits are ASC and which bits DESC?
  9. I copied your extra ")" if ($values['Workings1'] == "F") { $values['ExpiryDate'] = $values['Workings2']; } else if ($values['Workings1'] == "D") { $dateObj = new DateTime($values['IssueDate']); $dateObj->modify("+{$values['Workings3']} days"); $values['ExpiryDate'] = $dateObj->format('Y-m-d'); }
  10. try if ($values['Workings1'] == "F") { $values['ExpiryDate'] = $values['Workings2']; } else if ($values['Workings1'] == "D") { $dateObj = new DateTime($values['IssueDate']); $dateObj->modify("+{$values['Workings3']}) days"); $values['ExpiryDate'] = $dateObj->format('Y-m-d'); }
  11. What is your code where you create $values['IssueDate'] ?
  12. Sounds like you you have "modified_date" column in both tables. You have to specify which one to use order_history.modified_date or research_queue.modified_date
  13. What is the code where you (try to) create the object that is being cloned?
  14. "clone" doesn't use parentheses. EG $copy = clone $obj;
  15. By applying some thought to the problem and coming up with a logical sequence of events.
  16. The trick is to organize your code so that you collect the error messages before you do the print.
  17. Do you expect to see something when you print the contents of an empty array?
  18. OK, so you create an empty array print each value in this empty array put an item into the array So what error are you getting? What are you expecting that isn't happening? What is happening that you don't expect? Give me a clue!
  19. Use your table of member payments so you know which ones have been paid and when.
  20. Then you may be doing something wrong.
  21. Change line 8 to $Privilege = ""; At the moment $Privilege is defined inside a whilef() condition. If the condition is false (no records) then it is not defined.
  22. What you are now asking for is not what you originally asked for. I am not getting involved in an ever-escalating spiral of requirements (Not for free anyway). Hint: make "Africa/Abidjan" the key of the returned array and "[uTC/GMT +00:00] Africa/Abidjan" the value then build your options using both.
  23. Create a dateTime object for each timezone. Format the time with 'P' format. class Time_zone { private $regions = array( 'Africa' => DateTimeZone::AFRICA, 'America' => DateTimeZone::AMERICA, 'Antarctica' => DateTimeZone::ANTARCTICA, 'Artic' => DateTimeZone::ARCTIC, 'Asia' => DateTimeZone::ASIA, 'Atlantic' => DateTimeZone::ATLANTIC, 'Australia' => DateTimeZone::AUSTRALIA, 'Europe' => DateTimeZone::EUROPE, 'Indian' => DateTimeZone::INDIAN, 'Pacific' => DateTimeZone::PACIFIC ); public function generate_list() { $time_zones = array(); foreach ($this->regions as $name => $mask) { $time_zones[$name] = DateTimeZone::listIdentifiers($mask); } foreach ($time_zones as &$zones) { foreach ($zones as &$zstr) { $zn = new DateTimeZone($zstr); $t = new DateTime('now', $zn); $offset = $t->format('P'); $zstr = "[UTC/GMT $offset] $zstr"; } } return $time_zones; } }
×
×
  • 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.