Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. 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.
  2. As one of the mods on here will say: In programming, "automatic" means you write the code to do it.
  3. 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?
  4. 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.
  5. Still though, if you have a toronto web server that disappears off google and the american DNS system, that's not going to be very good for you. Sure, you probably can't actually be imprisoned in the US, but SOPA is designed to destroy foreign websites.
  6. 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()
  7. This is turning into another "small world" thread.
  8. Does that file actually exist? Is allow_url_fopen set to true in your php.ini?
  9. 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.
  10. 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.
  11. You'd still probably feel the effects of SOPA claims. You already can't watch a youtube video if there's a copyright claim against it in the US, a SOPA claim will knock a whole website off the DNS system, and canada just piggy-backs off the US for DNS. Where in Canada are you? I have family in Montreal, Nova Scotia, and Calgary.
  12. I imagine the "site blackouts" will be similar to what happened when they tried to make porn illegal: A black bar across the top of every porn site. Yes, I'm old, shut up.
  13. 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.
  14. Well if it's a "real" auction site with bid increments, the company controls the increments and there aren't ever decimals in the bid column. I worked at a "real" auction house and all our bids were round numbers.
  15. More from Zoe: If you are running cPanel, I highly, highly recommend, both for your sanity and the sanity of any support personnel who access your server, that you use cPanel's integrated nameservers. Simply point the NS records from your registrar to your cPanel box, and let cPanel handle all your domain records. If your mail is handled by cPanel, your MX records are automagic. They just work. Add subdomains? Just work. Add SPF or domainkeys? Just work. You then manage your DNS records in cPanel under the "Simple DNS Zone Editor" or "Advanced DNS Zone Editor." The zone editors check your records for sanity, so your nameserver won't fail due to malformed records or anything. Because you're running cPanel, you have a nameserver running ANYWAY, managed by your panel, so I highly recommend you use it unless you have a very specific reason to avoid it. One final pitch (as a professional support technician) your support tech will appreciate having all records handy in case of repair... and you'll appreciate not having to play go-for between support and your registrar when (not if, it's DNS, this stuff happens) things change. WITH ALL THAT SAID, I hate when people don't answer the question I ask, so in answer to your question, your checklist in your followup question is technically right and will work. Re scenario two, no; if you point your NS records to your VPS they will automatically work (after 24-72 hours as the DNS catches up it's caches) because cPanel manages them (see my overly wordy sales pitch above). The biggest thing to know about DNS is that there is one-only-one authoritative nameserver. All other nameservers have NS records which point to the authoritative nameserver. You just need to pick which server is the authoritative nameserver, and make sure all others point to it. It can be any server you want, but with cPanel it's best to use the built in one for sanity's sake.
  16. It depends on where the actual nameservers exist. If you are using the nameservers at your registrar, you need to put your MX record on the registrar; placing them on your server will do no good. As long as your mail exchanger information doesn't change, you don't need to edit the MX record at the registrar unless you change mail hosting. If, however, your VPS contains a nameserver (like if you are running cPanel), then you need to point the nameservers to your VPS at the registrar. You then put your MX record in your cPanel zone file. If you ever move nameservers to another server, you will need to move your MX record to the new server as well. It's an either/or. Domain names can (pretty much) only have one authoritative zone record (you can be on multiple nameservers, but that record better completely match on all of them or else really weird name resolution things happen), so you need to decide exactly where it will live and make sure your NS records at your registrar point there. --The above was written by my friend Zoe, a linux tech and network tech at HostGator. I don't know anything about this topic, but I knew she did. I probably won't be able to do any follow-up answers.
  17. where is it going then? make sure that your page is Registration.html and not registration.html, case sensitive. If the correct page is registration.html, change your form action accordingly Better yet, make sure the page is Registered.html
  18. Ok, a couple things: 1) Sessions are tracked via a cookie but they're not a type of cookie. The PHPSESSID cookie (which is random) is used as the key to the user's current session. 2) You only need session_start if that page will use the session, so don't add it to every page on the site, just every page that uses sessions. 3) If there's only one cookie, these are the ways that cookie can be dropped: A) timezone/timestamp issues, see aykay above B) You are calling a session function somewhere that you shouldn't be C) The session cookie isn't being set for the right domain. D) your IE settings are wrong or otherwise broken. 4) If you're just learning, you shouldn't be accepting credit card numbers. Paypal or google checkout is the way to go. Since this is an IE-only issue, it's probably nothing to do with your code. Check your IE security settings and whatnot.
  19. You should probably not post your datbase username and password in public, especially if your password is what you originally posted (you should change it. Now.) To actually address your question: yes, many ways. If there are equal numbers of columns in these tables, you can use UNION to join three queries together. If there aren't, you can simply perform three queries.
  20. They should all be integers if they're not going to be storing decimal values. And no, a value of "2" is not correct. I bet someone tried to put the comma into the query, causing the query to be malformed.
  21. v is not guaranteed to be a specific length under certain conditions. YIAV, reading the manual is the only way to learn. Will you remember anything about this thread in 3 months? Probably not. Would you remember if you had read the manual page with all the examples and details? probably. Also, there's only one official example in the manual, the rest are comments. Read until the comments end, that's all you usually need. $address = "http://www.youtube.com/watch?v=1234"; $a = array(); parse_str(parse_url($address, PHP_URL_QUERY), $a); echo $a['v'];
  22. Dolphin browser in desktop mode works fine for me.
  23. Parse_url
  24. This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=351181.0
  25. And if you don't understand something, say "I don't understand." Ignoring things that you don't understand is not how you progress as a programmer (or a human being for that matter). If someone tells you something will work, try it. If it doesn't work, say so. If it works and you don't know why, ask. What happened in this thread is that you asked a question. You were given the right answer right away. You then repeated your question, showing a slightly modified piece of code that didn't incorporate the most important part of the answer you were given. The answer was repeated by three people. You followed up with another repetition of your same question, a short exposition on your own thought process, and a third version of your broken code which still didn't include the important bits. Finally, someone got frustrated and was mean about it, which caused you to acknowledge the correct solution. What you're doing is encouraging people to be rude to you so that you'll be forced to actually read what they wrote. Also, don't report someone's post because they were mean, especially if they were mean for a damn good reason. Read the posts. Use the solutions provided. If you don't want the answer, why did you ask the question?
×
×
  • 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.