Adding an Item to a Shopper's Basket
The first thing we need to do is create the capabilities for a shopper to
add something to their basket. But, we also need to be able to
handle a variety of contingencies.
All of our basic functionalities will revolve around the basket, which we will not develop until the next webpage.
The following PHP page should be called add_item.php and it should be uploaded to your firefox website.
<!-- add_item.php - adding an item to a shopper's basket -->
|In ASP and SQL Server one would obtain the id_basket using
a second SELECT query within the SQL stored procedure
where we instantiate a new basket. The SQL Server command
looks something like the following
select idbasket = @@identity
It seems that in PHP/MySQL this is done by using a built-in PHP function rather than a MySQL command. At least I didn't discover such a MySQL command analogous to the SQL Server SELECT. In PHP/MySQL the function
is used to retrieve the auto-incremented id_basket for the most recent INSERT command.
We now give some discussion of the code.