SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Like Fedex and UPS Tracking

    I have an automotive biz. and I would like to create a part search like the way Fedex and UPS do their track packages when you go to there site http://www.fedex.com/Tracking you just enter in a bunch of tracking id's and place a space or hit return to start a new line. So you have a text area large enough for 100 lines or 100 unit id numbers. I would like to be able to paste a long row of item numbers into it and submit and fetch each one if its present in the database. I have a feeling it has to look for tabs or spaces in the "long string" and then query it with it breaking up the string by searching for a tab or a space between each individual item that is being looked for.

    Is this right?

  2. #2
    SitePoint Evangelist nsj's Avatar
    Join Date
    Oct 2005
    Location
    Jamaica (W.I)
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes... take a look at the explode function.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2005
    Posts
    122
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wanted to put the solution here so if anyone would like to use it.

    I looked at FedEx and UPS. They say where you put in your tracking number "ONLY USE ONE TRACKING NUMBER PER LINE" So when they send the tracking number individually to create the sql statement to return your information of your package on a per line basis it will have a carrage return in the line:/r so that is my seporator so when it reads the $output which is the name of my form, it breaks each number and then places a , in my IMPLODE so it will be in the right format for the sql stament and in this case i have 1000's of VIN numbers for cars. I wanted to be able to give my employees a way to copy and past 100's of VIN numbers from a spread sheet in excell and then return the information car by car and then if they want to drill down into each detail of a car they can by hitting a view details link on each car(not show here). Anyway, thats how i took the string and manipulated it.

    works like a top.


    Thanks NSJ for the push forward. Its what makes this site so great. The feedback.


    PHP Code:
    <?

    $pieces 
    explode("\r",$output);

    $sql "SELECT * from TABLE where vins in (".implode(",",$pieces).")";
    echo 
    "<U>$sql</U>";

    ?>

    // FORM BELOW SUBMITS TO ITSELF FOR EASE OF DEVELOPMENT FYI

    <HTML>
    <HEAD>
    </HEAD>

    <BODY>

    <FORM METHOD=POST ACTION="">
    <TEXTAREA NAME="output" ROWS="" COLS=""></TEXTAREA>



    <INPUT TYPE="submit">

    </FORM>
    </BODY>
    </HTML>

  4. #4
    Made with a Mac! philm's Avatar
    Join Date
    Sep 2001
    Location
    Portsmouth, UK
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey mbriggs, thanks for posting your solution.

    It bugs the hell out of me when I search the forums with a problem in mind, I find a post and they just say "thanks I sorted it" without letting us know how...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •