/    Sign up×
Community /Pin to ProfileBookmark

Shipping tracking Link output to google search from MYSQL Database

My question is on the output $tracking_number. I would like the tracking number the database outputs to be a link that popups a new tab in google search and searches Google for that tracking number. Another way of saying it would be $trackingnumber outputs a number from the database to become a link to google search so if the database outputs tracking number 9324832028 that number needs to become a clickable link to google search such as google.com/search?q=9324832028 any help would be appreciated.

<?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; ?>

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@ginerjmApr 25.2018 — So? Output the number as part of an anchor tag ("<a>").
Copy linkTweet thisAlerts:
@RossFauthorApr 25.2018 — @ginerjm#1591554

Hi ginerjm#1591554

This line

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

I need whatever $tracking_number outputs to become a hyperlink with the number inserted.

Example

The database outputs

Tracking Number: 923489234 <== This number needs to be a blue link to google search with that number search

Order Number: 234324

Parts: 30405324
Copy linkTweet thisAlerts:
@ginerjmApr 25.2018 — And..... As I said - make it an anchor tag!! You do know your HTML, don't you?
Copy linkTweet thisAlerts:
@ginerjmApr 25.2018 — Oh alright... Here. Untested but s/b close
<i>
</i>$output = "Tracking Number: &lt;a href='google.com/search?q=$tracking_number'&gt;$tracking_number&lt;/a&gt;";
$output .= "&lt;br /&gt;Order Number: $sales_order_number";
$output .= "&lt;br /&gt;Parts: $parts";
Copy linkTweet thisAlerts:
@rootApr 26.2018 — Daft question...

Why should someones order appear as a searchable item on google? Isn't that like exposing individuals PERSONAL INFORMATION to the world?
Copy linkTweet thisAlerts:
@ginerjmApr 26.2018 — As an adjunct to my post above - I only included the OP's data that he was showing previously. It is not part of the search of course, just part of his original display.
×

Success!

Help @RossF spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...