Jump to content

Mchl

Staff Alumni
  • Posts

    8,466
  • Joined

  • Last visited

Everything posted by Mchl

  1. Given that it's a recursive data structure... no As I said, you can use SplMaxHeap. You can use ArrayIterator to iterate over RecursiveDirectoryIterator and its children.
  2. You should create such indexes, that will bring benefits for your queries. There's no point creating an index for each field in a table, because many of them will never be used. In your case if the table is InnoDB, then a multi-column index created on (Username,Password) might yield really good results. Also a multi-column index on (uid, Password) is worth trying out.
  3. $client = new SoapClient("http://refrigerantcompliance/RefrigerantComplianceService/Service1.asmx?wsdl", array('cache_wsdl' => 0, 'trace' => 1)); $result = $client->GetWorkOrders(array("jobNumber" => "$jobnumber", 'subJobNumber' => "$subjobnumber")); $orders = $result->GetWorkOrdersResult->WorkOrderDAO; if(!is_array($orders)) { $orders = array($orders); }
  4. Can you show the query that is supposed to return this data? It seems that $row["CompletedIT"] is either empty, or is not in MySQL's data format.
  5. For MySQL PHP already offers OOP extension called mysqli, so there's no need in creating your own (you can however extend it to add your own functionality). Many people think OOP is about fancy syntax. It is not. OOP is about following simple (conceptually) rules, that force you to code in a specific way. Theoretically you could create an entire application as a single class, but that could hardly be called OOP, evn though you used object oriented syntax.
  6. echo pack('H*',"00238E010203"); [edit] Changed format a bit
  7. There's not much to criticise here. It's a simple class you see often in tutorials. In actual programming you most often declare fields private and access them through public getters and setters methods. Also it's usually a good idea to separate data presentation (displaying) from business logic. For example like this. <?php /** * This class responsiblity is to implement some business logic */ class MyClass { /** * myvar field */ private $myvar; /** * Setter method for myvar field */ public function setMyvar($v) { $this->myvar = $v; } /** * Getter method for myvar field */ public function getMyvar() { return $this->myvar; } } /** * This class responsibility is to display results */ class MyDisplayer { public function display(MyClass $myObj) { $v = $myObj->getMyvar(); echo "myvar = $v"; } } These two classes would work together like this: $obj1 = new MyClass(); $obj1->setMyvar('object1'); $displayer = new MyDisplayer(); $displayer->display($obj1); // you can now create another instance of class MyClass, and use $displayer to display it's content $obj2 = new MyClass(); $obj2->setMyvar('object2'); $displayer->display($obj2); This example is intentionally a bit oversimplified, but it should show you, that the power of OOP lies in cooperation between objects of different classes.
  8. You have $row = mysql_fetch_array($res); in line 9, then again in line 21 for different query (in which there's not T1 field).
  9. I guess you can say PHP is just stupid (in this case). It does not support syntax like this.
  10. Sorting could be performed by dumping contents into a SplMaxHeap The problem here is that you'd need to sort recursively each 'sub-iterator'.
  11. Well... since you're coming from C++ area, you can write your own extension and compile it into PHP 4.0.3... or you can just talk your boss into upgrading to something released in current century (and still supported!)
  12. Which version of PHP it is. sha1 is a core function and should be available in all PHP versions since 4.3.0. If you get this error, it might mean you're working on some really old version... in which case I am really sorry for you.
  13. It's a fatal error and therefore not catchable. You can set your own error handler, but fatal errors do not trigger it.
  14. $numRows = $result->num_rows; ... echo $totalRows;
  15. You've missed on comma (between 'a' and 's')
  16. May I ask what's the point of this? Hashing the hash 41 times doesn't make it any more hashed.
  17. 1. It's not encryption, it's hashing 2. hash
  18. You have: 1. missing quote in line 44 2. array values in double quotes not put in {} mysql_query("INSERT INTO mail (name, email) VALUES('{$_POST['name']}', '{$_POST['email']}' ) ")
  19. Erm... Three letters encrpypted into two? Anyway, take a look into str_replace() function.
  20. That's right. Or when you access class' static properties/methods for the first time.
  21. The class is declared, it's static properties and methods are available, so yes it will consume both time and memory. See here for autoloading classes on need: http://php.net/manual/en/language.oop5.autoload.php
  22. That seems to be qwerty keyboard layout shifted right one column. str_replace should be enough.
  23. Right. Just realised your solution will work, but there's something missing from it LIMIT "Rownums"-2,2 Also it's worth noting that COUNT(*) return results instantaneously in MyISAM, but not so in InnoDB.
×
×
  • 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.