Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. What makes you think it would return false? As you can see from the manual, mysql_query only returns false if the query fails or if the user does not have sufficient privileges to access the table.
  2. If could also contain your default value, 0000-00-00 00:00:00. Use var_dump like this: var_dump($row["login_timestamp"]);
  3. You need to have short_open_tag enabled in php.ini. That being said, I wouldn't recommend that you use short tags. Sticking to your current method is preferred because it will be more widely supported. If you use short tags and your code is transfered to a server that doesn't have them enabled you will encounter problems.
  4. If you want it to search all subdirectories recursively you'll need to use the RecursiveDirectoryIterator. Here's an example: $it = new RecursiveDirectoryIterator('path/to/dir'); foreach(new RecursiveIteratorIterator($it) as $path) { if(pathinfo($path, PATHINFO_BASENAME) == 'my.php') { echo $path . "<br />\n"; } }
  5. Yeah, it can be annoying when people use tables for their layouts or when they're not displaying tabular data. I usually refer them to http://shouldiusetableforlayout.com (oh I guess they moved it..) http://shouldiusetables.forlayout.com/
  6. Use the DirectoryIterator class to loop through the directories. To get the filename for comparison use the DirectoryIterator::getFilename() method, and to get the path of the files that match use the DirectoryIterator::getPathname() method.
  7. Based on the sheer scale and number of files you're dealing with it really wouldn't be practical to this on the fly. Imagine searching aimlessly through 1.1 million files every time you needed to find something? That would be a mess
  8. You could create a simple script to loop through all the directories and store the location of each file in MySQL. Then finding the location of the correct pdf to serve to the user given the filename would only take a quick MySQL query.
  9. if($choice == "YES" || $choice == "NO" || $choice == "MAYBE") { // ... } Or if you have a lot of possible values you might want to use an array and in_array like this: $arr = array('YES', 'NO', 'MAYBE'); if(in_array($choice, $arr)) { // .. }
  10. To understand why this happens you have to understand how cookies are sent to the server. Cookies are sent to the server only in the HTTP headers at the beginning of a HTTP request. Meaning that no matter what you do to the cookies during the script you won't notice a change until the next time the updated cookies are sent back to the server, which is on the next request.
  11. You're trying to close your function with the wrong curly bracket. Should be } not {.
  12. Alex

    Implode

    The manual is pretty self explanatory. It takes an array and combines all the elements into a string separated by whatever delimiter you supply. $arr = array('one', 'two', 'three'); echo implode('-', $arr); // one-two-three echo implode('|', $arr); // one|two|three implode. edit: Oh, and if you supply no delimiter it just puts them together like this: $arr = array('one', 'two', 'three'); echo implode($arr); // onetwothree
  13. Just compare the two HTML outputs to see what the difference is.
  14. Nothing in that code alone should called alert() twice with only one click. Is this the entire code?
  15. Are you sure that's the right info? It didn't work when I tried it here: http://www.yougetsignal.com/tools/open-ports/
  16. http://www.phpfreaks.com/forums/index.php/topic,300896.msg1424333.html#msg1424333
  17. echo substr(parse_url('http://www.mysite.com/services.php', PHP_URL_PATH), 1); parse_url.
  18. You forgot the quotes.. mysql_query("UPDATE users SET dp = dp - 0.005 WHERE id IN (SELECT author FROM posts WHERE id IN ($ids))");
  19. That was a typo.. He meant to type bloginfo() which you had in your original post but left off the b.
  20. Check out the manual on how to concatenate strings. $phpcode1 = '<a href="' . bloginfo('url') . $url . $item . '&type=' . $table . '">' . $item . '</a>';
  21. Oh, sorry I didn't realize that you were dealing with two different tables. So the author column on the posts table corresponds to the id column on the users table? UPDATE users SET dp = dp - 0.005 WHERE id IN (SELECT author FROM posts WHERE id IN ($ids))
  22. You need to explain better then, because your code really doesn't make any sense. You're selecting the author's names and then comparing it against the id column.. The ids of the posts selected should correspond to the ids of the rows you want to update, no?
  23. You can do it with just one query like this: UPDATE users SET dp = dp - 0.005 WHERE id IN ($ids)
  24. echo "Website: <a href=\"" .$row["biz_site"]. "\" target=_blank>Click here for website</a><br />\n";
×
×
  • 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.