Jump to content
Larry Ullman's Book Forums

Craig-UK

Members
  • Posts

    35
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Craig-UK

  1. I may be wrong here, but I think you need to put "more than or equal to", cause surely if there is only 1 item in the shopping cart you would still want it to show. A alternate is to change the 1 to a 0 and leave it as just "more than". Also shouldn't it be "mysqli_num_rows" rather than "mysqli_affected_rows"?!
  2. I know this probably doesn't really matter much, but I am wondering whats the best hash algorithm to use? Also what is the difference between them if any? My host supports md2, md4, md5, sha1, sha256, sha384, sha512, ripemd128, ripemd160, ripemd256, ripemd320, whirlpool, tiger128,3, tiger160,3, tiger192,3, tiger128,4, tiger160,4, tiger192,4, snefru, gost, adler32, crc32, crc32b, haval128,3, haval160,3, haval192,3, haval224,3, haval256,3, haval128,4, haval160,4, haval192,4, haval224,4, haval256,4, haval128,5, haval160,5, haval192,5, haval224,5, haval256,5. Also is it bad saying what the server supports (obviously wont on the site itself)?! (abit late I know) Thanks
  3. There is your problem, you have forgotten to include the $
  4. Hi, I am not sure if this of any help but a little something I worked on a couple weeks back. http://www.craig-uk.com/p/costs.php It's a simple script I made to work out the best option for myself if I chose to take payment online. Please note this is just a rough script of which there are additional costs such as setup charges, merchant account etc
  5. Thanks for noticing the problem Paul and thanks for your try at the script, but unfortunately didn't work Could you go a little into more detail as to how to achieve this if possible? I am just looking to do this so then only items within a certain mileage will show. P.S. Also as I forgot to mention before.... MySQL: 5.1.52 PHP: 5.2.17
  6. Hi Stuart, I have added that in http://www.flyinduck.com/distance.php. It seems like it can't recognise the "distance" column, even though it uses it for to order the results!? Hence why I am confused by it. btw I am in Southampton but I am originally from Birmingham.
  7. There are at least 200 records which are less than 1 mile out of 1,600,000+ records. If you click on the links I provided and type "so163hg" you should see 1 will work and the other wont. The one that does shows at least 100 records within a mile. Thanks for any help possible
  8. Sorry I should of been a lil more thorough about my query. Here is the scripts with and without the "WHERE" clause... http://www.flyinduck.com/distance1.php - Without $q = "SELECT postcode, ROUND(DEGREES(ACOS(SIN(RADIANS($lat)) * SIN(RADIANS(latitude)) + COS(RADIANS($lat)) * COS(RADIANS(latitude)) * COS(RADIANS($long - longitude)))) * 69.09, 2) AS distance FROM uk_postcodes ORDER BY distance ASC LIMIT 100"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) > 0) { http://www.flyinduck.com/distance.php - With $q = "SELECT postcode, ROUND(DEGREES(ACOS(SIN(RADIANS($lat)) * SIN(RADIANS(latitude)) + COS(RADIANS($lat)) * COS(RADIANS(latitude)) * COS(RADIANS($long - longitude)))) * 69.09, 2) AS distance FROM uk_postcodes WHERE distance<=1 ORDER BY distance ASC LIMIT 100"; $r = mysqli_query($dbc, $q); if (mysqli_num_rows($r) > 0) { Like I say I have tried it with "WHERE (distance<=1)" "WHERE distance<='1'" "WHERE (distance<='1')" Does it have anything to do with the fact that I put it to 2 decimal points? I did try the "WHERE" clause with "WHERE postcode != '$postcode'" which seemed to bring back results too. If there is any additional information you need please let me know and I'd gladly provide it. Thanks alot for any help
  9. Hi Larry, as like every says... fantastic books. I have 4. I can't seem to get my head around this 1 part. I have altered the Zip Code script to just do Postcodes for now without any stores/items. $q = "SELECT postcode, ROUND(DEGREES(ACOS(SIN(RADIANS($lat)) * SIN(RADIANS(latitude)) + COS(RADIANS($lat)) * COS(RADIANS(latitude)) * COS(RADIANS($long - longitude)))) * 69.09, 2) AS distance FROM uk_postcodes WHERE distance<=1 ORDER BY distance ASC LIMIT 100"; $r = mysqli_query($dbc, $q); The "WHERE" clause seems to not work. I have tried putting it in brackets, single quotations etc but still wont work. It does work without the "WHERE" clause though. Ideally I'd like it to limit the radius of searches. Can you see anything that I have done wrong? or what is the problem? I have had a look at other topics to see whether this has already been covered, but couldn't see anything. Thanks alot
×
×
  • Create New...