Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. The best way to do that is through ioncube or something similar. or simply through a legal agreement with the customer.
  2. Definitely not addslashes, that hasn't been recommended for years. If you're trying to include content inside of HTML tags, you should use the htmlentities() function.
  3. Why do you want this? Describe the problem you're trying to solve.
  4. Yes, obviously, so what you're saying is: "I have three numbers: 4, 9, 18. I want to find the minimum of these numbers, but I don't want to count the middle one, so how do I make it infinite?" Don't include it, and it can't possibly be the min...because it's not included. Call the function without that variable, and it can't possibly be the answer. What am I missing here?
  5. Josh's way is faster than mine, but he trims the trailing slash. You'll have to re-add it.
  6. Whoever told you to use magic_quotes or addslashes is wrong, or at least they stopped being right in 2003 when we moved to mysql_real_escape_string. I don't know where the carat is coming from though.
  7. Neither of the above will handle your second case. You want: echo preg_replace('#^(.*?/.*?/.*?/).*$#', "\\1", $yourString); -Dan
  8. 1) You don't need the array declaration in there, min() supports an infinite number of arguments. 2) Simply remove $maq entirely. You're asking "I want the minimum of two numbers, or infinity." Infinity is never the minimum of any set, just remove it.
  9. Then you have magic quotes turned on, check your php.ini Your slash has been backward in both of your examples so far. Is it really /' or is is \' ?
  10. What problem are you attempting to solve here?
  11. Don't use stripslashes or addslashes, and make sure magic_quotes is OFF. use mysql_real_escape_string on your INSERT statements only. Don't do anything when you retrieve the data.
  12. Ok, it might help if someone else says it: You cannot know what "too long" means in PHP. You can't. Look: WWWWWWWWWW <-- 10 Ws IIIIIIIIII <-- 10 Is See how those are drastically different widths? Now, a CSS way is really the only good way to do this because the browser will know how wide the text it's drawing will be, and the browser can then determine line breaks and line height, both of which can be specified by CSS.
  13. Google weights new sites more heavily than old. Release an update, redesign the site, do something to trigger the "new" flag.
  14. $a = '03-03-2008, 08:26 PM'; list($date, $time) = explode(', ', $a); list($month, $day, $year) = explode('-', $date); $b = strtotime("{$year}-{$month}-{$day} {$time}"); echo date('c', $b); //2008-03-03T20:26:00-05:00 -Dan
  15. You can't edit your post more than 30 seconds after you post it. It's one of the forum rules. The OP needs a lot more than just PHP GET functionality. None of his queries are even being run.
  16. setlocale changes the output of many functions, including date related functions. -Dan
  17. For the love of god space out your code. Why are your line breaks completely random? Your code, fixed: $id = mysql_real_escape_string(trim($_GET['id'])); $data = mysql_query("SELECT location FROM cities WHERE id = '$id' ") or die(mysql_error()); $info = mysql_fetch_array( $data ); { Print "".$info['location'] .""; } $data = mysql_query("SELECT id, location FROM cities GROUP BY location ORDER BY id ASC") OR DIE (mysql_error()); while($info = mysql_fetch_array($data)) { Print "<a href=locations.php?id=".$info['id']."'>".$info['location'] ."</a><br />"; } Now that it's formatted properly, you can see that your first block has a print() statement completely on its own inside an unnecessary set of curly braces. Why? There's no reason for it to be like that. You need a while loop there, which you might have thought you HAD already since you had the braces.
  18. As one of the mods on here will say: In programming, "automatic" means you write the code to do it.
  19. That's not listed in your code here, unless config.php includes include.php. Either way, run the queries. Handle any errors. Debug your logic. Where does $info come from?
  20. Taxes are where we run into the most problems. We end up with fractions of a rupee or a yen, and they don't do fractional currencies. However, that's why we round. The only time decimals are a real problem is for display purposes, where we have to do weird things. DECIMAL data types are good enough for the most part, since at some point you need to turn a whole number into a decimal for most applications.
  21. strtotime() won't work well on this particular format because it's ambiguous. You should use explode() to pull the date apart and then use mktime()
  22. Does that file actually exist? Is allow_url_fopen set to true in your php.ini?
  23. I'm afraid you're going to have to learn a lot more PHP in order to get this functional. You're not running any of these queries, for one. You're also not connecting to the database. MySQL and PHP are separate languages, you need to use PHP to build MySQL commands, then dispatch those commands to a MySQL server and process the results. Check the manual page for mysql_query for some examples. If this really is urgent, hire someone.
  24. Not in the DB, no, but in the programming language. We get weird 2.1300000001 results sometimes. They're rare, obviously, but we're a payment processor that works in two dozen currencies, storing everything as whole numbers and storing a "divisor" next to it is safer.
  25. True, but with floating point errors some companies (mine included) store even cents as whole numbers. We just divide by 100 when we display them.
×
×
  • 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.