473,480 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Do I need to use classes?

Hi again folks,
As a relative newbie I am probably trying to run before I can walk but here
goes:

Thanks to all you good folks I have managed to get some sort of a site up and
running whereby people can view my catalogue, select items from it and then send
the aggregate amount to PayPal for payment processing. I have a precheckout page
where people can view their selected items before proceeding to the final
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 face='Arial'
size='1'><u><b>Cat No</b></u></font></td>";
echo "<td bgcolor='#FF8000' valign='top' align='center'><font face='Arial'
size='1'><u><b>Description</b></u></font></td>";
echo "<td bgcolor='#FF8000' valign='top' align='center'><font face='Arial'
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] . "</font></td>";
echo "<td><font face='Arial' size='1'>" . $row[3] . "</font></td>";
echo "<td><font face='Arial' size='1'>£" . $row[6] . "</font></td>";
echo "</tr>";
$totalprice += $row[6];
}
echo "</table>";
echo "<p align='center'><b><font color='#FF0000'>Total price of selected items =
£$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' method='post'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='business' value='myemailaddress'>
<input type='hidden' name='item_name' value='aggregatepurchase'>
<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 make
payments over the internet.</b></p>
<p align='center'><input type='image' src='x-click-but03.gif' name='submit'
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 are
multiple users all trying to checkout at the same time and trying to access the
same checkout script? Do I need to use classes?

Any help/suggestions greatly appreciated.

Regards
Dynamo

Jul 17 '05 #1
2 1547

Dynamo wrote:
Hi again folks,
As a relative newbie I am probably trying to run before I can walk but here goes:

Thanks to all you good folks I have managed to get some sort of a site up and running whereby people can view my catalogue, select items from it and then send the aggregate amount to PayPal for payment processing. I have a precheckout page where people can view their selected items before proceeding to the final 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 face='Arial' size='1'><u><b>Cat No</b></u></font></td>";
echo "<td bgcolor='#FF8000' valign='top' align='center'><font face='Arial' size='1'><u><b>Description</b></u></font></td>";
echo "<td bgcolor='#FF8000' valign='top' align='center'><font face='Arial' 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] . "</font></td>"; echo "<td><font face='Arial' size='1'>" . $row[3] . "</font></td>"; echo "<td><font face='Arial' size='1'>£" . $row[6] . "</font></td>"; echo "</tr>";
$totalprice += $row[6];
}
echo "</table>";
echo "<p align='center'><b><font color='#FF0000'>Total price of selected items = £$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' method='post'> <input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='business' value='myemailaddress'> <input type='hidden' name='item_name' value='aggregatepurchase'> <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 make payments over the internet.</b></p>
<p align='center'><input type='image' src='x-click-but03.gif' name='submit' 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 are multiple users all trying to checkout at the same time and trying to access the same checkout script? Do I need to use classes?

Any help/suggestions greatly appreciated.

Regards
Dynamo


Jul 17 '05 #2
It does not look like you need to use a class, although it may make
things neater and nicer to deal with. There shoulden't be a PHP problem
if you have a mass of requests to the page so long as the SQL server
and web server are functioning properly and can handle the number of
requests.

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1607
by: Robert | last post by:
I have two tables (classes and students). Right now, I'm generating a report in asp that shows a list of classes, the enrollment for each class, and how many seats are available (see query below)....
2
1424
by: cm500 | last post by:
I'm very new to databases so bear with me. What I need is a way to track the training for the employees at my firm. I have 40 classes that I will be teaching on various subjects and various...
5
3467
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices...
2
1970
by: Andrew S. Giles | last post by:
OK, Ive run my head into this wall for too long. I need help. I am developing an applicaiton in C# to present a user with a GUI to specify a configurable list of machines that he wants to listen...
8
2302
by: Tim Geiges | last post by:
Since I am being challenged with learning c# I figured I could pass some of the pain on to you guys :-) I have another question(this one is important for me to fix before I can get my app to Beta)...
1
1150
by: bonk | last post by:
I have a set of unmanaged c++ classes that internally need to use managed classes (WPF formerly know as "Avalon") but I do not want to compile the whole MFC project with the /clr switch. What...
10
2005
by: Luke Meyers | last post by:
So, just a little while ago I had this flash of insight. It occurred to me that, while of course in general there are very good reasons for the conventional two-file header/implementation...
18
2306
by: bsruth | last post by:
I tried for an hour to find some reference to concrete information on why this particular inheritance implementation is a bad idea, but couldn't. So I'm sorry if this has been answered before....
1
3105
by: Tyno Gendo | last post by:
Hi everyone I need to move on a step in my PHP... I know what classes are, both in PHP4 and 5 and I'm aware of "patterns" existing, but what I'm looking for are some real world projects eg....
3
1988
by: =?Utf-8?B?SmF5IFZpbnRvbg==?= | last post by:
I see general messages about how to learn .NET but I have an immediate requirement to ramp up my old skills very quickly. Can anyone recommend the FASTEST way for me to get almost-competent in...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7060
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6760
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3004
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.