Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. Are they not on the manual download page?
  2. There's no submit button on that form. You're not submitting anything, leaving your $_POST and $_FILES arrays empty. -Dan
  3. preg_match_all
  4. The first error means you've mistyped your form field name. Print_r $_FILES to see what it should be. The second means that the form hasn't been submitted, or you've mistyped your submit button name. The third means that the URL doesn't contain the variables you think it does.
  5. you want a WHERE clause. And don't select make, count(make), just count(make).
  6. This is very difficult. "The easiest way" is going to take a new user a number of days. The US weather service has various public data streams you can use, or you could try to crawl weather.com or weatherunderground.com's data files or pages. -Dan
  7. What, exactly, is the problem? I see a properly formatted INSERT statement. Have you done any debugging on your own? Have you echoed the query or checked the mysql error message?
  8. Make `email` a unique key and use INSERT IGNORE, the database will handle destroying duplicates. -Dan
  9. We had a similar discussion over on DevShed more than 4 years ago. Some good code samples in there for variable variables as well. -Dan
  10. You should probably read the first 4-5 chapters of the MySQL manual.
  11. Don't use ereg, it's deprecated. Use preg instead. Email address validation is a lot harder than you think. -Dan
  12. And yet, after this entire conversation, you've still missed the point. Here it is for the last time: Variable variables are wrong, in almost every situation. Even with all the discussions, all the analogies, and all the experts telling you that you're doing it wrong, you still think that we should have provided you with the method to do it the wrong way. We wouldn't be very helpful if that's what we did, would we? You're still learning. Part of the learning process is differentiating between "possible" and "correct." Yes, it's entirely possible to use variable variables. In fact, it's possible to combine variable variables, anonymous functions, and variable function names to make code that is completely illegible and impossible to debug. This is the difference between "possible" and "correct." What you were asking was possible, but it was incorrect. In an attempt to try to HELP you rather than simply acting like breathing PHP manuals, we told you the right way to do it. In the future, if all you want is the syntax for how to do a specific thing, read the PHP manual, that's what it's for. Since you asked a question of other human beings, we provided additional information on proper PHP usage. -Dan
  13. Excellent use of an incorrect analogy. Well done. Nobody told you to use PERL, we told you to use PHP properly. If someone asked how to repair the tire on their bike with tin foil and paste, would you help? You've still missed my point: You're a new developer. We expect you to come back. We have no problem with you coming back, but in order to decrease our future headaches, we tell you the proper way to do things so that in a month when you come back, your code isn't completely unreadable. You're perfectly welcome complain about it, but now you know the right way to do things. The fact that arrays would make your code readable, easier to maintain, and legible is in addition to the fact that arrays will simply work faster and more efficiently, and will allow your application to be more powerful. -Dan
  14. The whole server locks up? Have you tried letting it finish, or running an EXPLAIN against that query? Have you indexes these columns properly and set up a foreign key for this relationship? -Dan
  15. Three. Three responses before you gave the actual error you've had all along.
  16. That's basically what this code does. Have you tried any sort of debugging on your own? Echo the values of all the variables you're using, make sure they're correct. Echo the queries, make sure they're not malformed. Run the queries by hand, see if the output is what you expect. Etc etc.
  17. Sure it does! Hint: "Doesn't work" has no meaning. Explain.
  18. When using mysqli_connect, you need to use mysqli_real_escape_string. -Dan
  19. If I said to you "hey I'm building a house and I have an entire wall made out of Lego already, how do I run electrical wire through lego walls?" what would you say? Would you tell me the answer, or would you say "use wood to make a house"? We don't want to help you do something wrong, only to have you come back in 3 weeks saying "my variable variables are acting up and I can't possibly debug them because I've used variable variables so I can't tell what's happening." This is why the usenet/forum mantra is usually "tell us what you're trying to accomplish, don't ask how to implement what you've decided is the solution." That being said, ${"SomeStringWith" . $variables} is the actual solution, but it's wrong, and if you come back with problems someone will ask you why you've done it wrong. In case you haven't found it, the PHP manual section on arrays is here. -Dan
  20. Variable variables are almost always the wrong idea. While the above is technically an answer to you, it makes your code horribly difficult to maintain and edit in the future.
  21. You would use an array, though be warned that your database design is wrong. You should be breaking these columns out into their own table, research third normal forms. -Dan
  22. Or simply preg_replace_callback
  23. This code may not have been inserted by your "third party," but may actually have been the work of a fourth party, some nefarious spammer who gained access to your system. If you have PHP code, you need a PHP developer. Hop on over to the "for hire" section (or call a consulting company) and get someone to do a full audit of your codebase. There's obviously a security flaw, either intentional or accidental. -Dan
  24. Don't do it like that, use an array. $someArray[$counter] = 'abc'; -Dan
  25. Once all articles are marked "published" he wants to "reset" the table so that they're all unpublished again. In English, "Update the table, set published = 1 where ALL ROWS are published = 0." I can see why you're confused. -Dan
×
×
  • 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.