Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. The getElementsByTagName() method must be obsolete in your version of DOM. Check the methods list for your version.
  2. function days_between($fyear, $fmonth, $fday, $tyear, $tmonth, $tday) { $diff = abs((mktime ( 0, 0, 0, $fmonth, $fday, $fyear) - mktime ( 0, 0, 0, $tmonth, $tday, $tyear))/(60*60*24)); if($diff >= 1) { return false; } return true; } if(!days_between(2008, 10, 2, 2008, 10, 15)) { echo "your payment is overdue"; }
  3. file_get_contents() will return false on error. An error of level E_WARNING is generated using fopen() and will return false however you can supress errors with @fopen(). fopen() will not work if allow_url_fopen is set to false in the remote server php configuration (if they are using php). This is unlikely to be the case if it is an RSS feed. I would ammend your code structure using file_get_contents() to store in a variable first. If the variable has a string length then continue with your aggregation.
  4. Im betting on $Image having no value
  5. function days_between($fyear, $fmonth, $fday, $tyear, $tmonth, $tday) { return abs((mktime ( 0, 0, 0, $fmonth, $fday, $fyear) - mktime ( 0, 0, 0, $tmonth, $tday, $tyear))/(60*60*24)); } echo days_between(2008, 10, 2, 2008, 10, 15);
  6. Follow Mchl's guidelines, however if you are not planning on migrating this to work from a SQL database rather than a MYSQL database I would prefer to use a INNER JOIN instead of a CROSS JOIN.
  7. I would not use this approach for a few of reasons: 1. It is not normalised 2. If a person is removed from an event it requires more application logic to update the table 3. If you wanted to sort records by event ID more application logic is required Your current design is optimal.
  8. If you use a varchar you can set the 6 permissions like this: 0,1,1,0,1,1 6 numbers - 0 is off, 1 is on. Making them comma separated will be easiest. Then when you get the record from the database you can create an array of the permissions using: $permissions = explode(",", $databaseRow); Using a print_r($permissions) will produce: array( [0] => 0, [1] => 1, [2] => 1, [3] => 0, [4] => 1, [5] => 1, } And make it easy to test the values.
  9. Yep zanus is correct. Used that method also. As stated use if you have many permission settings.
  10. Have you set: DirectoryIndex index.html in you httpd.conf
  11. It will be an empty value so I would use an ENUM(1,2) 1 being off, and 2 being on. All you need is: $value = strlen($_POST['checkboxName']) ? 2 : 1; Replace 'checkboxName' with the name you give to the checkbox field. If the box is clicked the $value is set to 2. If not $value is set to 1. You can then use $value in your database insert query. Simple.
  12. Whatever you set the value attrib on the checkbox to is what is posted when checked. If not checked the post value is empty so: checkbox name="x" value="1" /> If it is checked there will be a value of 1 in $_POST['x']. If not no value. I would use an ENUM field type to store this data. You could have values of 1, 2 (I tend not to like using 0)
  13. Because a class constructor is a magic method that is automatically called when you create an instance of a class (an object). You do not need to call it like regular methods so it can set the class variables straight away for use by any of the class methods. Example class dog { private $name; public function __construct($name) { $this->name = $name; } public function getDogName() { return "The dogs name is ".$this->name; } } $myDog = new dog("Rover"); print $myDog->getDogName();
  14. Maybe because of your mysql configuration settings: max_user_connections
  15. No, just run 2 queries, 1 for each table to keep it simple
  16. How many records do you get from the query: SELECT CurrencyID, Abbreviation FROM `".CURRENCY_TABLE."`WHERE Active = '1' ORDER BY Name
  17. By setting an environment variable: putenv("TZ=US/Eastern"); This would have to be at the top of each file so when you use the date() function it uses the correct zone.
  18. page.php?id=x The value of x is probably used to lookup the row containing the content for the page from a database table photos.php is a completely different file and must have code to get images from a different database table "www.mywebsite.com/page.php?id=photos" Will not work To save the php code into a mysql field will require php knowledge and modification of the code in page.php to tell it to expect code when id=photos
  19. Websites (that need to rank) should be designed around SEO concepts from the start of development. On-site optimisation on a website that has not been designed in an SEO friendly manor is difficult and sometimes impossible leading to re-development. This includes things like URLS, modifying content, modifying templates, meta tagging, avoiding duplication of pages, etc
  20. If you have more methods in the class that use the same variables then set them in the constructor so you dont have to keep passing them into class methods
  21. I think PHP Architect did an article on this a while back from memory. Have a look through their back catalogue. http://www.phparch.com/
  22. I dont think there are any libraries for PHP to do this. There are simple OCR techniques that people have developed for reading CAPTCHA images but not whole documents.
  23. Change <option value="InaRelationship" name="InaRelationship"<?php echo $row['relationship'] ==InaRelationship ? "selected=\"selected\"": "" ?>> code] to [code]<option value="In a Relationship" name="InaRelationship"<?php echo $row['relationship'] ==InaRelationship ? "selected=\"selected\"": "" ?>> [/code]
  24. After: // Assume invalid values: $un = $fn = $ln = $e = $p = $g = FALSE;
  25. This is not special code. These are php constants with template replacement markers. So {SITEDISCLAIMER} will be replaced with whatever the value is set to using whatever template processor Joomla uses.
×
×
  • 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.