•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,566 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,659 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1292 | Replies: 8 | Solved
![]() |
•
•
Join Date: Feb 2005
Posts: 20
Reputation:
Rep Power: 4
Solved Threads: 0
I have a database that returns information about a customer's jobs that have shipped. It displays correctly, but I would like the carrier name to be a link to the carrier's website so the customer can track it on line. I have the carrier's website listed in the database. how do I make the carrier's name print as a link to their website?
Any help would be greatly appreciated!
$resultb = mysql_query("SELECT * FROM orders WHERE mold='$mold' and shipdate is not null",$db);
if ($myrow = mysql_fetch_array($resultb)) {
echo "<BR/><table cellpadding=\"3\" cellspacing=\"3\" border=\"0\">\n";
echo "<tr bgcolor=\"#B9B8B8\"><td><span class=\"bold\">Mold Number</span></td><td><span
class=\"bold\">Date Shipped</span></td><td><span class=\"bold\">Carrier</span></td><td><span class=\"bold\">Tracking Number,</span></td></tr>\n";
do {
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td>%s</tr>\n", $myrow["mold"],$myrow["shipdate"], $myrow["carrier"], $myrow["tracking"]);
} while ($myrow = mysql_fetch_array($resultb));
}
Any help would be greatly appreciated!
$resultb = mysql_query("SELECT * FROM orders WHERE mold='$mold' and shipdate is not null",$db);
if ($myrow = mysql_fetch_array($resultb)) {
echo "<BR/><table cellpadding=\"3\" cellspacing=\"3\" border=\"0\">\n";
echo "<tr bgcolor=\"#B9B8B8\"><td><span class=\"bold\">Mold Number</span></td><td><span
class=\"bold\">Date Shipped</span></td><td><span class=\"bold\">Carrier</span></td><td><span class=\"bold\">Tracking Number,</span></td></tr>\n";
do {
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td>%s</tr>\n", $myrow["mold"],$myrow["shipdate"], $myrow["carrier"], $myrow["tracking"]);
} while ($myrow = mysql_fetch_array($resultb));
}
•
•
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation:
Rep Power: 5
Solved Threads: 7
Where is the carriers website address stored? Is it in the orders table? If not then you will need to modify your sql statement to perform a join to the table containing the carrier website address. You can then modify your do loop to build a standard href attibute around the carrier name.
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation:
Rep Power: 5
Solved Threads: 7
Try this:
do {
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td><a href=\"%s\">%s</a></td><td>%s</td>\n", $myrow["mold"],$myrow["shipdate"], $myrow["carrier"], $myrow["tracking"]);
} If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation:
Rep Power: 5
Solved Threads: 7
Sorry, missed out one of the carrier calls. Should read:
do {
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td><a href=\"%s\">%s</a></td><td>%s</td></tr>\n", $myrow["mold"],$myrow["shipdate"], $myrow["carrier"], $myrow["carrier"]
, $myrow["tracking"]);
} If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Feb 2005
Posts: 20
Reputation:
Rep Power: 4
Solved Threads: 0
That almost worked.
Now it gives the path of http://www.mydomain.com/www.carriers domain.com
I want it to be http://www.carriers domain.com
Now it gives the path of http://www.mydomain.com/www.carriers domain.com
I want it to be http://www.carriers domain.com
•
•
Join Date: Jul 2004
Location: Sydney, Australia
Posts: 166
Reputation:
Rep Power: 5
Solved Threads: 7
How is the carriers url stored in the database? If it is just in the format www.carriersdomain.com then you will need to force the http:// onto the front of it, otherwise the system assumes it is a local path. Try:
do {
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td><a href=\"http://%s\">%s</a></td><td>%s</td></tr>\n", $myrow["mold"],$myrow["shipdate"], $myrow["carrier"], $myrow["carrier"]
, $myrow["tracking"]);
} If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
•
•
Join Date: Feb 2005
Posts: 20
Reputation:
Rep Power: 4
Solved Threads: 0
That gave me a result of http://www.mydomain.com/carriers name.
So I changed the script to
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td><a href=\"http:\\%s\">%s</a></td><td>%s</td></tr>\n", $myrow["mold"],$myrow["shipdate"], $myrow["website"], $myrow["carrier"]
, $myrow["tracking"]);
That gave me a result of http://www.mydomain.com/www.carriersdomain.com.
So I changed the carriers web address in the database to http://www.carriersdomain.com.
That gave me a result of http://www.mydomain.com/http://www.carriersdomain.com.
I am using a mysql database, and have the field type set to varchar.
Is it possible that the field type is incorrect?
I have a test order set up in the database. If you would like to see how it is working, I can email you the domain with the user name and password for the test order.
Thanks
So I changed the script to
printf("<tr bgcolor=\"#EAE8E8\"><td>%s</td><td>%s</td><td><a href=\"http:\\%s\">%s</a></td><td>%s</td></tr>\n", $myrow["mold"],$myrow["shipdate"], $myrow["website"], $myrow["carrier"]
, $myrow["tracking"]);
That gave me a result of http://www.mydomain.com/www.carriersdomain.com.
So I changed the carriers web address in the database to http://www.carriersdomain.com.
That gave me a result of http://www.mydomain.com/http://www.carriersdomain.com.
I am using a mysql database, and have the field type set to varchar.
Is it possible that the field type is incorrect?
I have a test order set up in the database. If you would like to see how it is working, I can email you the domain with the user name and password for the test order.
Thanks
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Setiing Field width in a record (Pascal and Delphi)
Other Threads in the PHP Forum
- Previous Thread: New Calendar Idea Needed
- Next Thread: Jumping into Php


Linear Mode