Can you figure out how to alter this script?

10 replies
Hey Programming warriors!

As the title says, I was hoping one of you could give me a hand with this script.

Currently the script will check to see if a 5 digit number is in the database, then if it is not there, it will add it (a user puts it in a box and hits submit).

I need it to ONLY check to see if the number is there. And then redirect them as it is doing now. I dont want it to enter any numbers in to the database, I want it to leave the database alone, and just check and redirect.

Here it is:

I know an incy-wincy bit about code, but not nearly enough to do this. I dont want to do anything that creates safety problems either.

After 2 years being on the WF, I know the best place to ask first is here
#script
  • Profile picture of the author Ashley Gable
    Alright, doesnt matter, I cant get the post to save with the code in it. Even after wrapping it in code tags:confused:

    It just keeps showing a blank page. Its alright when the code isnt there, so I am guessing some part of it is interfering or something.

    Thanks anyway!
    {{ DiscussionBoard.errors[4955126].message }}
    • Profile picture of the author khay
      Originally Posted by Ashley Gable View Post

      Alright, doesnt matter, I cant get the post to save with the code in it. Even after wrapping it in code tags:confused:

      It just keeps showing a blank page. Its alright when the code isnt there, so I am guessing some part of it is interfering or something.

      Thanks anyway!
      Use Pastebin.com and people could modify the code and create a new paste.
      {{ DiscussionBoard.errors[4955332].message }}
      • Profile picture of the author mattmax
        I can help you do this, no problem. You can dropbox it, and PM me the link, or. . .

        Should not be hard to do.
        {{ DiscussionBoard.errors[4955346].message }}
  • Profile picture of the author mmstud
    What database and programming language or framework are you using?
    {{ DiscussionBoard.errors[4955468].message }}
  • Profile picture of the author Ashley Gable
    Actually I see that it is using mysql.class.php

    I will post it as well. but I didnt realize it was going to be this complicated. I dont want to take up your time with this if it is hard.

    I dont know what constitutes hard in programming (with me its everything!) so I will post it anyway. If it is an easy fix, I would appreciate it. If it is going to take you longer than 5 minutes, pm me and we can work out a deal.

    Thanks, here it is: zipcodechecker2 - Pastebin.com

    Ashley
    {{ DiscussionBoard.errors[4957734].message }}
  • Profile picture of the author eminc
    Hi

    Comment the line 30 shown on this URL zipcode checker - Pastebin.com .

    In short, search for this,
    $conn->insert('zipcodes', array('zipcode' => $zip));

    And add a // before it

    //$conn->insert('zipcodes', array('zipcode' => $zip));

    It won't insert zipcode in your database.

    Mohit
    {{ DiscussionBoard.errors[4958007].message }}
  • Profile picture of the author DivMaster
    Hello Ashley, if i understand correctly you dont wants to add zip code if it do not exist, here is a bit modifed code but this will always redirect to redir_b.htm file you have.
    http://pastebin.com/tMLYwKzH

    are you looking for that?

    Raza
    {{ DiscussionBoard.errors[4958009].message }}
    • Profile picture of the author Ashley Gable
      Originally Posted by Mohit Jawanjal View Post

      Hi

      Comment the line 30 shown on this URL zipcode checker - Pastebin.com .

      In short, search for this,
      ('zipcodes', array('zipcode' => ));

      And add a // before it

      //('zipcodes', array('zipcode' => ));

      It won't insert zipcode in your database.

      Mohit
      Hey thanks! It worked!

      Thank you so much, I truly appreciate it.

      Originally Posted by DivMaster View Post

      Hello Ashley, if i understand correctly you dont wants to add zip code if it do not exist, here is a bit modifed code but this will always redirect to redir_b.htm file you have.
      [PHP] <?php require_once('mysql.class.php'); // CHANGE THESE TO VALID FOR YOUR - Pastebin.com

      are you looking for that?

      Raza
      yeah I didnt want it to add to the database, but I still need it to check if the zipcode is there, and redirect to the appropriate page.

      I tried Mohit Jawanjal first and it worked! But thank you for taking the time to help me out.

      Thanks everyone!
      {{ DiscussionBoard.errors[4958112].message }}
  • Profile picture of the author mattmax
    Glad you got it sorted out!
    {{ DiscussionBoard.errors[4958850].message }}

Trending Topics