Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. Read a tutorial. You've written ASP, not PHP. We're not going to just translate it for you, sorry.
  2. I rarely write code for this sort of thing but this one was a challenge This will make a multi-dimensional array with each dir id. <?php $list = array(); $list[] = array('dir'=>1,'indir'=>0, 'name'=>'Dir1'); $list[] = array('dir'=>2,'indir'=>0, 'name'=>'Dir2'); $list[] = array('dir'=>3,'indir'=>1, 'name'=>'Dir3'); $list[] = array('dir'=>4,'indir'=>3, 'name'=>'Dir4'); $list[] = array('dir'=>5,'indir'=>1, 'name'=>'Dir5'); $main = getLevels(0); //Recursive function to get any subdirectories. function getLevels($levels){ global $list; foreach($list AS $key=>$listed){ if($listed['indir'] == $levels){ $subdir[$listed['dir']] = getLevels($listed['dir']); unset($list[$k]); } } return $subdir; } print_r($main); ?> See it in action: http://www.grady.us/test/dirs.php
  3. This gives a syntax error, but shows what I'm trying to do. If I don't pass it a username and password, I want to use the class values. function login($username=$this->username, $password=$this->password){ //mah code! } My solution: function login($username=NULL, $password=NULL){ if($username == NULL){ $username = $this->username; } if($password == NULL){ $password = $this->password; } //mah code! } Anyone know of a better way to do this? Or is the the only way? Obviously it works, I just hate the null checks.
  4. you can access a session variable on the same page you set it.
  5. You can turn on errors like that wuhtzu.
  6. Without modrewrite, you cannot do that.
  7. make an array of all of those field names, and then do a foreach
  8. Are you already using mod_rewrite to make that url go to a page which has $id=123?
  9. When they are traveling, they're probably not changing their computer's time. Why not just let them select DST yes or no when they select their timezone?
  10. the last id of what? the last inserted? mysql_insert_id()
  11. Did you look in the manual? http://www.php.net/manual/en/function.timezone-offset-get.php There are 6 or 7 functions at the bottom having to do with timezones, that address the local DSTs of those.
  12. Yes, it has got them. You just can't see them, because phpMyAdmin is converting them for you. Did you try using the function yet?
  13. try removing the error suppressors (the @) and see if there are any errors.
  14. With code. We can't tell how you specifically would do it without seeing your script. Why don't you try to follow one of the many tutorials out there for user authentication.
  15. because it is an array. You could also use substr and strpos.
  16. What do you mean it doesn't perform? If it matches on the first one it doesn't need to check the second. What is the value of $stuff?
  17. you can combine date with strtotime.
×
×
  • 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.