12 Replies - 405 Views - Last Post: 26 April 2018 - 04:20 AM

#1 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:06 PM

This line
$output = "Tracking Number: $tracking_number<br />Order Number: $sales_order_number<br />Parts: $parts";

I'm trying to figure out how to make $tracking_number output to become a hyperlink for google search with the outputted number search in google.

Example

The database outputs

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

After $output = "Tracking Number: $tracking_number<br /> I tried inserting this $output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>"; but it does not seem to work it actually crashes the search box.

Is This A Good Question/Topic? 0
  • +

Replies To: Shipping tracking Link output to google search from MYSQL Database

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14845
  • View blog
  • Posts: 59,243
  • Joined: 12-June 08

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:09 PM

Why wouldn't you use the specific carrier's tracking system?
Was This Post Helpful? 0
  • +
  • -

#3 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:12 PM

To be honest. This is for a very very small group and all of us are fine with it be thrown out to google and letting google decide the carrier. All in all it only comes down to and extra click. I'm trying to keep the complication factor down on the code as much as possible.
Was This Post Helpful? 0
  • +
  • -

#4 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:18 PM

View Postmodi123_1, on 25 April 2018 - 12:09 PM, said:

Why wouldn't you use the specific carrier's tracking system?


Also the database will only be used for a few months.
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14845
  • View blog
  • Posts: 59,243
  • Joined: 12-June 08

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:29 PM

Mkay.

As it is - it works well enough for me.. so something else must be mucking it up.
Was This Post Helpful? 0
  • +
  • -

#6 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2760
  • View blog
  • Posts: 10,948
  • Joined: 03-December 12

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:33 PM

What makes you think that google will give you the right direction in the first place?

https://stackoverflo...racking-numbers
Was This Post Helpful? 0
  • +
  • -

#7 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:39 PM

View Postmodi123_1, on 25 April 2018 - 12:29 PM, said:

Mkay.

As it is - it works well enough for me.. so something else must be mucking it up.



This is the whole code

<?php
$output = NULL;

if(isset($_POST['submit'])){
     //Connect to the database
      $mysqli = NEW  MySQLi("","","","");

 $search = $mysqli->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<br />Order Number: $sales_order_number<br />Parts: $parts";
      }
  }else{
      $output = "No results";
  }
}
?>


<form method="POST">
<input type="TEXT"  name="search" />
<input type="SUBMIT" name="submit" value="Search" />
</form>

<?php echo $output; ?>



Everytime i insert it i lose my search box

View Postastonecipher, on 25 April 2018 - 12:33 PM, said:

What makes you think that google will give you the right direction in the first place?

https://stackoverflo...racking-numbers



dealing mostly with fedex and usps. The link you gave me is way over my station.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14845
  • View blog
  • Posts: 59,243
  • Joined: 12-June 08

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:53 PM

... so no 'a href' string concatenation?

View PostRossF, on 25 April 2018 - 02:39 PM, said:

[...] way over my station.
Station?
Posted Image
Was This Post Helpful? 0
  • +
  • -

#9 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:55 PM

View Postmodi123_1, on 25 April 2018 - 12:53 PM, said:

... so no 'a href' string concatenation?

View PostRossF, on 25 April 2018 - 02:39 PM, said:

[...] way over my station.
Station?
Posted Image



I tried using this

$output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>"; 


but it does not seem to work it actually crashes the search box.

View Postmodi123_1, on 25 April 2018 - 12:53 PM, said:

... so no 'a href' string concatenation?

View PostRossF, on 25 April 2018 - 02:39 PM, said:

[...] way over my station.
Station?
Posted Image


Its a really old way of saying way above your head
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14845
  • View blog
  • Posts: 59,243
  • Joined: 12-June 08

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 12:57 PM

What search box? In a google page? I certainly can't get that to happen.
Was This Post Helpful? 0
  • +
  • -

#11 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 01:00 PM

I tried using this

$output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>"; 


but it does not seem to work it actually crashes the search box.

View Postmodi123_1, on 25 April 2018 - 12:53 PM, said:

... so no 'a href' string concatenation?

View PostRossF, on 25 April 2018 - 02:39 PM, said:

[...] way over my station.
Station?
Posted Image


Its a really old way of saying way above your head
[/quote]


I tried doing this
$output = "Tracking Number: $tracking_number<br />$output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>";Order Number: $sales_order_number<br />Parts: $parts";


that didnt work

View Postmodi123_1, on 25 April 2018 - 12:57 PM, said:

What search box? In a google page? I certainly can't get that to happen.


No my database has a search function you enter a order# and it displays the tracking #. I tried insert this string of code every which way and the page just goes blank.

$output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>";


View Postmodi123_1, on 25 April 2018 - 12:57 PM, said:

What search box? In a google page? I certainly can't get that to happen.


No my database has a search function you enter a order# and it displays the tracking #. I tried insert this string of code every which way and the page just goes blank.

$output += "<br><a href="https://google.com/search?q=$tracking_number">Search</a>";

This post has been edited by astonecipher: 25 April 2018 - 01:15 PM
Reason for edit:: retroactively removing quotes

Was This Post Helpful? 0
  • +
  • -

#12 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2760
  • View blog
  • Posts: 10,948
  • Joined: 03-December 12

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 25 April 2018 - 01:45 PM

The link was to work out an algorithm for determining carrier. Depending on what carriers you use, it can get simple.

Then, you just link to the carrier site with the tracking number.




Complete list of compatible carriers and formats.
Enter label numbers, spaces optional, for items using these services:

Quote

Carrier	Sample Number Formats
USPS®	0300 0000 0000 0000 0000
9400 1000 0000 0000 0000 00
USPS® Certified Mail®	7000 0000 0000 0000 0000
9407 1000 0000 0000 0000 00
USPS® Priority Mail International®	CP 000 000 000 US
USPS® Priority Mail®	1400 0000 0000 0000 0000
9205 5000 0000 0000 0000 00
USPS® Registered Mail™	RA 000 000 000 US
9208 8000 0000 0000 0000
FedEx®	9999 9999 9999 
9999 9999 9999 999
UPS®	1Z99999999999999900000999
99999T99999999



https://www.ideone.com/a6m6mn
Was This Post Helpful? 0
  • +
  • -

#13 RossF   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 25-April 18

Re: Shipping tracking Link output to google search from MYSQL Database

Posted 26 April 2018 - 04:20 AM

just for anybody that runs into the problem. I finally got it to work the proper code insert is

$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";

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1