If a customer s ID is (Bulletproof web design) 123, you will
If a customer s ID is 123, you will see all the order_totals for all the orders for that specific customer, enabling you to determine all the money customer 123 has spent at your store. Although you are linking the two tables through the cust_ID field, the names do not have to be the same. You can compare any two field names from any two tables. An example would be: $query = SELECT customers.name, orders.order_total FROM customers, orders WHERE customers.email = orders.shiptoemail ; //retrieves customers names from customers table and order_total from //orders table where the email field in the customers table equals the //shiptoemail field in the orders table. This would link your tables through the email and shiptoemail fields from different tables. Try It Out Referencing Individual Tables This exercise will show you how to reference multiple tables in your query. 1. Change your select2.php program as shown here (changes are highlighted): 1990 . ORDER BY movie_type ; $results = mysql_query($query) or die(mysql_error()); echo
| n ; echo $value; echo |
n ; ?> 2. Save your script and run it. Your screen should look something like Figure 3-3. 106 Chapter 3
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services