| re: Do I need to use classes?
Dynamo wrote:[color=blue]
> Hi again folks,
> As a relative newbie I am probably trying to run before I can walk[/color]
but here[color=blue]
> goes:
>
> Thanks to all you good folks I have managed to get some sort of a[/color]
site up and[color=blue]
> running whereby people can view my catalogue, select items from it[/color]
and then send[color=blue]
> the aggregate amount to PayPal for payment processing. I have a[/color]
precheckout page[color=blue]
> where people can view their selected items before proceeding to the[/color]
final[color=blue]
> payment stage. My script is as follows:
>
> $query = 'SELECT * FROM Catalogue WHERE id IN (' . implode( ',',
> $_POST['selection'] ) . ')';
> $result = mysql_query($query) or die ("Error in query: $query. " .
> mysql_error());
> $totalprice = 0;
> echo "<table cellpadding=2 border=0>";
>
> echo "<tr>";
> echo "<td bgcolor='#FF8000' valign='top' align='center'><font[/color]
face='Arial'[color=blue]
> size='1'><u><b>Cat No</b></u></font></td>";
> echo "<td bgcolor='#FF8000' valign='top' align='center'><font[/color]
face='Arial'[color=blue]
> size='1'><u><b>Description</b></u></font></td>";
> echo "<td bgcolor='#FF8000' valign='top' align='center'><font[/color]
face='Arial'[color=blue]
> size='1'><u><b>Price</b></u></font></td>";
> echo "</tr>";
>
> while($row = mysql_fetch_row($result)) {
> echo "<tr>";
> echo "<td><font face='Arial' size='1'>" . $row[0] .[/color]
"</font></td>";[color=blue]
> echo "<td><font face='Arial' size='1'>" . $row[3] .[/color]
"</font></td>";[color=blue]
> echo "<td><font face='Arial' size='1'>£" . $row[6] .[/color]
"</font></td>";[color=blue]
> echo "</tr>";
> $totalprice += $row[6];
> }
> echo "</table>";
> echo "<p align='center'><b><font color='#FF0000'>Total price of[/color]
selected items =[color=blue]
> £$totalprice</br>Your credit card will be debited with this
> amount</br></font></b></p>";
> echo "<form action='https://www.paypal.com/cgi-bin/webscr'[/color]
method='post'>[color=blue]
> <input type='hidden' name='cmd' value='_xclick'>
> <input type='hidden' name='business'[/color]
value='myemailaddress'>[color=blue]
> <input type='hidden' name='item_name'[/color]
value='aggregatepurchase'>[color=blue]
> <input type='hidden' name='currency_code' value='GBP'>
> <input type='hidden' name='amount' value='$totalprice'>
> <p align='center'><b>Payment method is via PayPal - The secure way to[/color]
make[color=blue]
> payments over the internet.</b></p>
> <p align='center'><input type='image' src='x-click-but03.gif'[/color]
name='submit'[color=blue]
> alt='Make payments with PayPal - it's fast, free and secure!'></p>
> </form>";
>
> Yeah Yeah I know it needs tidying but it works.
> My question is will it work in the real world. What happens if their[/color]
are[color=blue]
> multiple users all trying to checkout at the same time and trying to[/color]
access the[color=blue]
> same checkout script? Do I need to use classes?
>
> Any help/suggestions greatly appreciated.
>
> Regards
> Dynamo[/color] |