Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. Check the session variable to see if a registered user is logged in before you increment the vote count. If they're not then throw an error message.
  2. Try this, an example from the manual: isEmptyDir($dir){ return (($files = scandir($dir)) && count($files) } ?>
  3. Yes, but you should be fixing your errors before putting your code live. They are still exploitable and a security concern.
  4. That's great to hear, it's nice to see threads like this.
  5. I see, but doesn't the ORDER BY and GROUP BY take care of that? My logic is that if you're ordering by 'ID DESC', which orders the list greatest to least by ID, and 'GROUP BY Sport', which would rid duplicates, then you wouldn't need to use MAX() because these 2 clauses assume that.
  6. Isn't that essentially the same query I gave him?
  7. Not to my knowledge, the shortest code is probably almost the same as what you already have: foreach($arr as $a) if($a['age'] == 3) echo $a['name']; The only other thing I can think of would be using the array_search() function and passing the returned key to the array, but I think you would still have to have some kind of iteration. Something like: echo $arr[array_search(3, $arr)];
  8. That too One more thing, use tags. Improves readability.
  9. Kind of. You would have to match on those characters and patterns. It would look something like: $html = "bold textclick me"; $pattern = "~^(.*)(.*)~i"; preg_match_all($pattern, $html, $matches); echo "Bold: " . $matches[1][0] . " href: " . $matches[2][0]; ?> - The (.*) will capture any 0 or more characters in that position and add it to the $matches array. - The '\s', takes care of whitespace. - I had to escape the '.' because they are special characters (wildcards). So by escaping them, the pattern will take the dots as literal dots. - The tildes (~) are my delimiters and you need them around your pattern. - Finally the 'i' flag is for case-insensitivity. For more information read the tutorial here on phpfreaks - Regular Expressions (Part1) - Basic Syntax. You should also take a look at the function documentation from the manual - preg_match_all.
  10. I don't think 'fight' would be the best word, maybe swallow whole? Sorry Pug, but I'm sure you would serve as a delicious hors ‘d orderve.
  11. You can accomplish this with either file_get_contents or cURL and preg_match_all. If you do a search in either here, or the PHP Regex section, you should be able to find helpful threads and similar ideas that will assist you. Good luck.
  12. There's one on phpfreaks but it's database driven, which is worth learning and better in the long run anyway. PHP Basic Pagination
  13. You should have thrown the Grizzly Bear in the mix. I mean look at their advantages: Even though the Polar Bear is bigger, I think the Grizzly would take it out. It's like fighting a 300 lb. fat kid who gasses in less than a minute, render him useless. I vote for the Kodiak.
  14. So you've checked user id in the database to make sure it's not being updated? (SELECT * from users WHERE id = 31) If not, how do you know the table isn't being updated? Doesn't make any sense. I guess I'm missing something. If the query was invalid then the error reporting would display an error for you mysql_query call. I guess you can add the or die clause to see if your query is failing: (make sure to take it out when we're done) $query=mysql_query($_rs) or die(mysql_query()); By the way, if you are using a single table you don't need to have the format 'table'.'field', you can just do 'field'.
  15. At first, I thought Polar bear. I remember hearing they are the biggest predatory bears on the planet, then, after reading this, I change my answer to Kodiak, good thing I didn't vote yet.
  16. Echo out '$_rs' to ensure the correct values, if any, are being passed to the '_updateparticipant.php' script.
  17. Help with finding a tutorial? Here's one, with what looks like, some good documentation. http://arshaw.com/fullcalendar/docs/
  18. I understand the concern about the hyphen, but why would it be necessary to add a bang to the end?. Gotcha now, I was being a little dense earlier. Thx CV.
  19. This makes the minimal 2, did you have a specific setting? Try this: if(preg_match("/^[a-z\d][\w-.]{1,14}/ i", $user) )
  20. Would you mind sharing for future references? Also, please mark as solved, bottom left right above "quick reply".
  21. So if you hard code that value in, you still get incorrect dates? Try this and tell me what you get. $i=1; $startDate = "01-06-2009"; echo $startDate; echo " "; $finishDate = "30-06-2009"; echo $finishDate; echo " "; $startDate = date("d-m-Y", strtotime("$startDate +$i Day")); echo $startDate; echo " "; $finishDate = date("d-m-Y", strtotime("$finishDate +$i Day")); echo $finishDate; echo " "; ?> My output:
  22. Yes, it is a reserved word - http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html You need to put backticks around it (`Index`), rather than single quotes.
  23. Works fine for me, tried $i=1; and $i=5. How are you initializing $i?
  24. Like we said, you should have your dates as type 'DATE' or 'TIMESTAMP' so you can perform logical operations like this.
×
×
  • 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.