954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Paypal shopping basket link

Alfa_romeo_Logo.jpg Headlight Protectors Part Number Make Model Year Range



Description

Price

Shipping Cost

 

<?php
$db = mysql_connect("HOST_NAME","DB_NAME","DB_PASSWORD");
mysql_select_db("DB_NAME",$db);
$result = mysql_query("SELECT * FROM Items WHERE Category=35",$db);
while ($myrow = mysql_fetch_row($result)) (
printf("%s%s%s%s%s%s%s%s\n",
$myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[7], $mysql[8]));
echo "\n";
?>






 

huwgomez
Newbie Poster
6 posts since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

Hey Huw,

You'll need to do something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- This site was created by Huw Hughes - [email]huw_hughes712@hotmail.com[/email] -->
<HTML><HEAD>
<TITLE></title>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="website/Page1_files/page.css" rel=stylesheet>
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
<META http-equiv=Last-Modified content=22/05/2004:08:35:13>
<META http-equiv=Pragma content=no-cache></HEAD>
<BODY>
<div align="center">
<center>
<table cellpadding="0" cellspacing="0" style="border-collapse: collapse; font-family:Arial Black; color:#FFFFFF; text-align:center" bordercolor="#000000" width="80%" id="AutoNumber1" bgcolor="#003163">
<tr>
<td width="100%" colspan="8" align="center" valign="top" height="1" bgcolor="#FFFFFF">
<img border="0" src="headlight_protectors_files/Alfa_romeo_Logo.jpg"></td>
</tr>
<tr>
<td width="100%" height="24" align="center" colspan="8" bgcolor="#000000">
<font face="Arial Black" size="4" color="#FFFFFF">Headlight Protectors</font></td>
</tr>
<tr>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Part Number</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Make</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Model</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<p align="center"><font face="Arial Black" color="#FFFFFF">Year Range</font></td>
<td width="23%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Description</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Price</font></td>
<td width="12%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
<font face="Arial Black" color="#FFFFFF">Shipping Cost</font></td>
<td width="5%" height="30" background="headlight_protectors_files/top_bg.jpg" align="center">
&nbsp;</td>
</tr>
<?php
$db = mysql_connect("HOST_NAME","DB_NAME","DB_PASSWORD");
mysql_select_db("DB_NAME",$db);
$result = mysql_query("SELECT * FROM Items WHERE Category=35",$db);
while ($myrow = mysql_fetch_row($result))
{
$paypal_code = '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it\'s fast, free and secure!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="PAYPAL_ACCOUNT_USERNAME">
<input type="hidden" name="item_name" value="'.$myrow[0].'">
<input type="hidden" name="item_number" value="'.$myrow[1].'">
<input type="hidden" name="amount" value="'.$myrow[2].'">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="GBP">
</form>';
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[0], $myrow[1], $myrow[2], $myrow[3], $myrow[4], $myrow[5], $myrow[7], $paypal_code));
}
?>
</table>
</div>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="PAYPAL_ACCOUNT_USERNAME">
<input type="image" src="https://www.paypal.com/en_GB/i/btn/view_cart_02.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="display" value="1">
</form>
<!-- This site was created by Huw Hughes - [email]huw_hughes712@hotmail.com[/email] -->
<p>&nbsp;</p>
</BODY></HTML>

jt1
Newbie Poster
19 posts since Aug 2007
Reputation Points: 13
Solved Threads: 3
 

It's also good practice to clean-up when you're finished with your MySQL results:

@mysql_free_result($result);


This would go at the end of your while loop

jt1
Newbie Poster
19 posts since Aug 2007
Reputation Points: 13
Solved Threads: 3
 

I'm sure Huw would have found this information very helpful - three years ago :P

Still, perhaps someone else will have a similar need and find it here now.

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

Hehe, sorry, my bad. I suppose that's what you get for answering at 3am on a Sunday morning.

You'll probably see a couple of others where I didn't read the date...

I'll apologise now in advance :$

jt1
Newbie Poster
19 posts since Aug 2007
Reputation Points: 13
Solved Threads: 3
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You