Database Reference
In-Depth Information
Figure 11-41
Continued
Example 3: Invoking a Stored Procedure
We created a stored procedure named InsertCustomerAndInterest for the SQL Server 2012,
Oracle Database 11 g Release 2, and MySQL 5.6 versions of the VRG database in Chapters 10A,
10B, and 10C, respectively. In all cases, the stored procedure accepts a new customer's last
name, first name, area code, local number, and e-mail and the nationality of all artists in whom
the customer is interested. It then creates a new row in CUSTOMER and adds appropriate
rows to the CUSTOMER_ARTIST_INT table.
To invoke the stored procedure using a PHP page using PDO, we create a Web form page
to collect the necessary data, as shown in Figure 11-42. Then, when the user clicks the Add
New Customer button, we want to invoke a PHP page that uses PDO to call the stored pro-
cedure the form data as the input parameters. So that the user can verify that the new data
have been entered correctly, the PHP then queries a view that joins customer names with
artist names and nationalities. The result is shown in Figure 11-43. In this case, we are adding
Richard Baxendale, with phone number 206-876-7733 and e-mail address Richard.Baxendale@
elsewhere.com . Richard is interested in United States artists.
 
Search WWH ::




Custom Search