Jump to content

nathanb

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by nathanb

  1. Ah, thank you! It turned out to be an error in my PHP code, but the IN() clause sure looks like a smarter way to accomplish this. Thanks a lot!
  2. Alright, so I have a PHP script that helps me select the zip codes in a certain radius of a certain zip code. This works perfect, and gives me an array including the valid zip codes. I want to use this array to select users who have these zip codes, so I used some more PHP to help me make a query like this: [code]SELECT * FROM users WHERE (zip = '41017' OR zip = '41011' OR zip = '41012' OR zip = '41018' OR zip = '41019' OR zip = '41016') AND valid_email = '1' ORDER BY username ASC LIMIT 0, 20[/code] So, in theory, this would select any users who have one of the above zip codes. It appears to find the right users correctly, but [u]only one result is returned[/u]. For example, I have 2 users with the zip '41017'. This query only returns the first of these users (depending on if the ORDER BY is ASC or DESC), instead of both. Any ideas? Also, is there a better way to do this? Because as the radius increases, the number of applicable zip codes increases exponentially. Thanks for any help!
  3. Ack! I knew it was going to be something simple like that! Thank you! And, luckily, it looks like the rest of the site is already adapted for the slashes, this was just a minor oversight.
  4. Hi, I am editing a script and sometimes this query works and sometimes it does not. Here is the particular code that is (sometimes) malfunctioning: [code]if (($_POST['description']!='DEBUG')||(!in_array('DEBUG', $_POST))) $query1 = mysql_query("INSERT INTO countdowns (`creator`, `creationdate`, `countdowndate`, `type`, `description`, `private`, `timezone`, `special`, `specialinfo`) VALUES ('$creator', '$creationdate', '$countdowndate', '".($tag=='official'?'official':'user')."', '$description', '$private', '$ctimezone', '$special', '$specialinfo')");[/code] In a working case, the variables include something like this: [code]$creator = '1'; $creationdate = '1141347209'; $countdowndate = '1141362000'; $description = "rarw"; $private = '1'; $timezone = 'GMT-5'; $special = ''; $specialinfo = '';[/code] and it goes through as expected as it always did. Another working case is this: [code]$creator = '1'; $creationdate = '1141347209'; $countdowndate = '1141362000'; $type = ''; $description = "So and so.. Auction Ends"; $private = '1'; $timezone = 'GMT-5'; $special = 'ebay'; $specialinfo = '4437837371';[/code] But this and others do not work: [code]$creator = '1'; $creationdate = '1141347209'; $countdowndate = '1141362000'; $description = "Jim's 1st Anniversary"; $private = '1'; $timezone = 'GMT-5'; $special = 'anniversary of marriage'; $specialinfo = '1st|Jim';[/code] The $query1 variable appears to be null, but it shouldn't. mysql_error() says that it is not a valid MySQL Link Resource.. Note that this doesn't happen in the above working cases. Any ideas? Thanks in advance!
×
×
  • 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.