Jump to content

requinix

Administrators
  • Posts

    15,227
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Yes: put it into load_elements() instead. Specifically, put it at the end of the bit that loads (asynchronously I assume) the tables and divs.
  2. If you don't mind refreshing the page then you just use normal PHP form handling stuff. If you don't want to refresh then look into a little thing called "AJAX"...
  3. Where's .ajaxForm defined? Where are PN and frmFeilds coming from?
  4. You have to give a name that list.
  5. Then what's your code?
  6. INT versus VARCHAR (ie, number versus string): - Use numbers if the data is a number. An actual number. Just consisting of digits isn't enough (but does get you far). - Use strings for just about everything else. Default value versus empty versus NULL (ie, there's always a value versus the field can be left literally empty versus using a NULL: - Use default values when you need a value all the time and simply might not have collected it. As in "if I don't have a number then I'll assume it's X". - Use an empty value... Off the top of my head I don't have any examples of when you should do this. - Use NULL when you want to indicate that the data is missing. Not there. You don't have it. NULL is not a value - it is an absence of a value. Based on that and what I can guess about your purpose, I say a NULLable INT field. Stick a number in there when you have a number, or leave it as NULL when you are missing a number. Beyond that general advice and assumptions with it, what is this field for?
  7. First I have a couple questions: why are there three columns and what are they for?
  8. If by "PHP comform" you mean "work", then mysqli_query() can't run multiple queries. Luckily mysqli_multi_query can.
  9. requinix

    $GET

    There's typecasting, number functions, string checking, // for example, (int)$_GET['v'] floor($_GET['v']) == ceil($_GET['v']) (float)$_GET['v'] == ($_GET['v'] + 0) ctype_digit($_GET['v']) or regular expressions which you shouldn't use because there's plenty of better options.
  10. Jelly Bellys. So there are "recipes" of ones you can eat at the same time. The most well-known one is probably mixing a couple peanut butter jelly beans with a couple grapes. I have to say it's pretty good because they actually do taste like peanut butter and grapes, but I have one issue: the peanut butter flavor is too weak compared to the grape. Instead of a 1-1 ratio it takes more like 3-1. Weird thing, this has got to be the most famous recipe so why isn't it listed on their site? I see candy apple, tiramisu, and lemon meringue pie, but nothing about peanut butter and jelly sandwiches. Are they just not popular anymore? Personally I prefer peanut butter and chocolate (Nutella, specifically) but whatever. Which can't be that weird because Reese's is popular... Mind you peanut butter + Nutella sandwiches don't really taste like Reese's candies, but that could just be because of the type of chocolate. Like they use milk or dark chocolate while Nutella is based on hazelnut. Which reminds me, I have a jar of it in the cupboard, but it's been so long since I've used it that it might have turned into an oily mess by now. I know it's just the various oils and such separating but it looks like someone poured a teaspoon or two of water right into it and that just kinda puts me off the whole thing. Same for peanut butter for that matter except the "water" isn't clear. Dirty water. And mixing everything back together isn't so bad but it gets the knife dirty on the handle, which really bothers me because then my fingers get dirty and I have to stop what I'm doing and go wash my hands. I already do that enough each day, I don't want to make more reasons for me to do so. But beyond the oily mess there's also stuff getting stale. Stale Nutella is a pain because it's stiff and hard to deal with, and the kind of bread I like most is very soft and easily rips apart so spreading it on can be a real labor. Best method I've found is to spread a little bit on at a time but it takes so long to cover the whole face. Fine, it's a good sandwich, but in that same time I could have done something else. Maybe there's something in the freezer I could quickly heat up, or maybe there's some leftovers in the fridge I could eat. And if not there's pretty good odds that I need to go to the grocery store anyways. Ah, sorry. Forgot why I'm here. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=358112.0
  11. Make a MySQL function that looks something like SELECT @i = SUBSTRING(tag_id, 2) FROM tags ORDER BY LEN(tag_id) DESC, tag_id DESC LIMIT 1; RETURN CONCAT("c", @i + 1); If you need the number padded to at least two digits then throw in an LPAD. Be sure to use a transaction in case two INSERTs try to run at the same time.
  12. Are you making the file include() itself?
  13. What would come after "c99"?
  14. Ternary. It's called the ternary operator.
  15. Where are the s?
  16. Really? Because there's actually a problem: timer is always null. Move the var timer outside the click() handler and rename it to something more specific than "timer".
  17. clearInterval() needs the timer to stop it, not the code to execute. Including a couple other fixes, $("#play-pause-button").click(function(){ var timer = null; if(timer == null){ timer = setInterval(goForward, 5000); $("#play-pause-button").html("").load(function(){ $("#play-pause-button").val("on"); }); } else { clearInterval(timer); timer = null; $("#play-pause-button").html("").load(function(){ $("#play-pause-button").val("off"); }); } return false; });
  18. Ah, the other way. Besides Psycho's code (which is how I'd do it), you can UNION two queries: SELECT the ones that are 0000-00-00 and tack on the ones that aren't (and are before today's date).
  19. That's weird but not impossible (clearly). Before we start looking at the more unusual explanations, can you post the code you're having problems with?
  20. border isn't deprecated. cellspacing can be expressed in CSS with border-spacing: border-spacing: 0px; However you might be looking to "collapse" the borders, for which you'd use border-collapse: collapse; instead.
  21. This topic's house has been seized by the bank and it now lives in MySQL Help until it can get back on its feet. http://www.phpfreaks.com/forums/index.php?topic=358035.0
  22. Add a condition for the date: either it's "0000-00-00" or it's on/after today's date. Then a normal ORDER BY should take care of the rest.
  23. stripslashes() is about making sure PHP's old magic_quotes setting (if present) does not screw up the submitted value. If you don't stripslashes() and magic_quotes is on then characters like apostrophes and quotation marks will have backslashes to "escape" them. But you do your own escaping so it ends up that the backslashes come in literally and you end up with people's names like "O\'Brien". mysql_real_escape_string() makes a string safe for inclusion directly into a SQL query, so long as you put it in quotes. It does not affect what the data is - only how it is represented in the query. Those two happen on the input side of things. When you're inserting data into your database. When the data comes out and you output it into something like HTML or XML, it might not be safe. For instance, it could contain s and at the worst means someone can insert arbitrary HTML into your page. Just like how MySQL has mysql_real_escape_string() there is the htmlspecialchars() function for HTML (and XML). That escapes s and quotes so that the string couldn't possibly affect the markup of a page. That's a good function but for HTML (only, not XML) there's a better function: htmlentities(). Besides doing everything the other function does, when used properly this one will make sure the output doesn't contain any "invalid" characters. For example: á. Your page might not use a character encoding that supports that character so htmlentities() will turn it into á - something that will always work because it represents the á character not as bytes but as "an 'a' with an acute". Correct, and do it just before you echo it into the HTML as a code safety measure. Databases should contain raw values in their original form. Using htmlentities() means you've corrupted the data and turned it into an HTML-safe string. For a lot of purposes that's okay because the data will only go back into HTML later on, but it's not okay because of the other things you might want to do to it. Common examples: - Insert the data into an RSS feed (which is XML). XML doesn't support HTML entities like á and will barf if you try to use one* - Measure the string length. If you were to impose a maximum string length of 10 characters, and someone enters "páginas" the length check will incorrectly fail because it measures "páginas" (14 characters) instead of "páginas" (7 characters) - Use the value in AJAX. If the code treats the AJAX results as text strings (as opposed to HTML strings) then you might end up with "páginas" literally in the HTML. * It's possible to include a definition of HTML entities, and that would allow you to use entities, but it's work that you don't really need to do. There's also a risk of XML parsers that aren't aware this kind of thing is possible.
  24. You can do it inline. Most of the time you should use classes and selectors to get what you need, such as naming the table with class="controle", but occasionally it makes sense to do a bit of styling inline with the element. Like now. "</pre> <table style="'background:" forminputs>"</
×
×
  • 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.