Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Shipping tracking Link output to google search from MYSQL Database

Shipping tracking Link output to google search from MYSQL Database

Scheduled Pinned Locked Moved Database
databasemysqlcomsalesjson
12 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B bfg9000d360

    This line
    $output = "Tracking Number: $tracking_number
    Order Number: $sales_order_number
    Parts: $parts";

    I need whatever $tracking_number outputs to become a hyperlink for google search with the outputted number search.

    Example

    The database outputs

    Tracking Number: 923489234 <=This number needs to be a blue hyperlink link to google search with that number search
    Order Number: 234324
    Parts: 30405324

    Once that tracking number is search in google, google determines what carrier it is saves me allot of trouble. I wish it was this simple $output = "Tracking Number: $tracking_number link google.com/search?q=$tracking_number any ideas guys. Thanks

    The rest of my code is below if you want to view it.

    real\_escape\_string($\_POST\['search'\]);
     
     //Query the database
      $resultSet = $mysqli->query("SELECT \* FROM invlist WHERE sales\_order\_number = '$search'");
    
      if($resultSet->num\_rows > 0){
          while($rows = $resultSet->fetch\_assoc())
          {
               $tracking\_number = $rows\['tracking\_number'\];
    		   $sales\_order\_number = $rows\['sales\_order\_number'\];
    		   $parts = $rows\['parts'\];
               
    		   $output = "Tracking Number: $tracking\_number  
    

    Order Number: $sales_order_number
    Parts: $parts";
    }
    }else{
    $output = "No results";
    }
    }
    ?>

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Google shows URL's from the sites it has crawled. To become part of the search-results, they URL's must be submitted to Google. Ask Google to recrawl your URLs - Search Console Help[^]

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

    B 1 Reply Last reply
    0
    • L Lost User

      Google shows URL's from the sites it has crawled. To become part of the search-results, they URL's must be submitted to Google. Ask Google to recrawl your URLs - Search Console Help[^]

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

      B Offline
      B Offline
      bfg9000d360
      wrote on last edited by
      #3

      somebody said to add this but it does not seem to be working

      $output += "
      Search";

      L Richard DeemingR 2 Replies Last reply
      0
      • B bfg9000d360

        somebody said to add this but it does not seem to be working

        $output += "
        Search";

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        Of course it didn't. Google doesn't read your code. If your link appears on the web, and that location is indexed, then that URL will be indexed.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

        B 1 Reply Last reply
        0
        • L Lost User

          Of course it didn't. Google doesn't read your code. If your link appears on the web, and that location is indexed, then that URL will be indexed.

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          B Offline
          B Offline
          bfg9000d360
          wrote on last edited by
          #5

          I think we are getting crossed here on what I need. I have a searchable database that I created, when you enter the order number it outputs this information Tracking Number: Order Number: Parts: ----------------------- Ok lets say my database yielded these results Tracking Number: 123219843 Order Number: 9432 Parts: 234923 Since the database yielded Tracking Number: 123219843 I need to have that number thrown over to google to be searched by google. so it needs to become a link. I dont want to have to phyiscally copy and paste the tracking number into google.

          L 1 Reply Last reply
          0
          • B bfg9000d360

            I think we are getting crossed here on what I need. I have a searchable database that I created, when you enter the order number it outputs this information Tracking Number: Order Number: Parts: ----------------------- Ok lets say my database yielded these results Tracking Number: 123219843 Order Number: 9432 Parts: 234923 Since the database yielded Tracking Number: 123219843 I need to have that number thrown over to google to be searched by google. so it needs to become a link. I dont want to have to phyiscally copy and paste the tracking number into google.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            If you want your link to show up, you have to submit it, or a page containing those links.

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

            1 Reply Last reply
            0
            • B bfg9000d360

              somebody said to add this but it does not seem to be working

              $output += "
              Search";

              Richard DeemingR Offline
              Richard DeemingR Offline
              Richard Deeming
              wrote on last edited by
              #7

              What do you mean by "not working"? If it generates a link that looks like:

              <a href="https://www.google.com/search?q=123219843">Search</a>

              then it should work: Search Depending on the tracking code, it might not find the results you want. But it will open a Google search for the tracking code.


              "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

              "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

              B 1 Reply Last reply
              0
              • Richard DeemingR Richard Deeming

                What do you mean by "not working"? If it generates a link that looks like:

                <a href="https://www.google.com/search?q=123219843">Search</a>

                then it should work: Search Depending on the tracking code, it might not find the results you want. But it will open a Google search for the tracking code.


                "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                B Offline
                B Offline
                bfg9000d360
                wrote on last edited by
                #8

                well i tried inserting this code

                $output += "
                Search";

                into

                $output = "Tracking Number: $tracking_number
                Order Number: $sales_order_number
                Parts: $parts";

                and it keeps crashing my search box.

                Richard DeemingR 1 Reply Last reply
                0
                • B bfg9000d360

                  well i tried inserting this code

                  $output += "
                  Search";

                  into

                  $output = "Tracking Number: $tracking_number
                  Order Number: $sales_order_number
                  Parts: $parts";

                  and it keeps crashing my search box.

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #9

                  I don't know what "crashing my search box" means. I notice you're overwriting the $output variable for each record. Does your search only ever return a single result?


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  B 1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    I don't know what "crashing my search box" means. I notice you're overwriting the $output variable for each record. Does your search only ever return a single result?


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    B Offline
                    B Offline
                    bfg9000d360
                    wrote on last edited by
                    #10

                    correct. i tried doing this

                    $output = "Tracking Number: $tracking_number
                    $output += "
                    Search";Order Number: $sales_order_number
                    Parts: $parts";

                    but it did not work

                    Richard DeemingR 1 Reply Last reply
                    0
                    • B bfg9000d360

                      correct. i tried doing this

                      $output = "Tracking Number: $tracking_number
                      $output += "
                      Search";Order Number: $sales_order_number
                      Parts: $parts";

                      but it did not work

                      Richard DeemingR Offline
                      Richard DeemingR Offline
                      Richard Deeming
                      wrote on last edited by
                      #11

                      How about:

                      $output = "Tracking Number: $tracking_number<br /><a href=\"https://google.com/search?q=$tracking\_number\\">Search</a><br />Order Number: $sales_order_number<br />Parts: $parts";

                      NB: You need to escape the quotes inside the string. PHP: Strings - Manual[^]


                      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                      B 1 Reply Last reply
                      0
                      • Richard DeemingR Richard Deeming

                        How about:

                        $output = "Tracking Number: $tracking_number<br /><a href=\"https://google.com/search?q=$tracking\_number\\">Search</a><br />Order Number: $sales_order_number<br />Parts: $parts";

                        NB: You need to escape the quotes inside the string. PHP: Strings - Manual[^]


                        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                        B Offline
                        B Offline
                        bfg9000d360
                        wrote on last edited by
                        #12

                        that did it thanks so much

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups