Tazzy12 Posted August 1, 2006 Posted August 1, 2006 I have a script that will read and write to a MYSQL dbase, but I'm having difficulty integrating it with OSCommerce's MYSQL dbase settings. I'm new to all this so I wanted to check with the experts here before making changes. The script's settings are as follows: $DbTableNameProducts="products"; $DbProductsId="id"; $DbProductsDescription="description"; $DbProductsPrice="price"; $DbProductsLocation="location"; $DbProductsExpiry="expiry"; In PhpMyAdmin, it looks like the fields I need are spread out over several tables, not just $DbTableNameProducts="products". The Products table seems to contain the products_id and products_price fields. The Products Description table seems to contain the products_id, products_description, and products_url fields ($DbProductsLocation="location"). The Configuration table seems to contain the expiry field. How would I accurately edit the above script to have everything corresponding properly? Thanks, Taz
Dutch317 Posted August 2, 2006 Posted August 2, 2006 If I understand you problem correctly what you need to do is to use a join in the database query, something like: $result = mysql_query("SELECT a.products_description, b.products_id, b.products_model FROM products_description a, products b, configuration c WHERE a.products_id=b.products_id and b.products_model=c.expiry")or die("Invalid query: " . mysql_error()); This code is just random but just to show the format. You define the fields for the SELECT by adding letter such as "a.products_id" then define that "a" (table) in the FROM section "products a" so to select the model number and description which are in two diffrent tables to display you would use something like this: $result = mysql_query("SELECT a.products_description, b.products_id, b.products_model FROM products_description a, products b WHERE b.products_id=a.products_id")or die("Invalid query: " . mysql_error()); Hope this helps
Tazzy12 Posted August 4, 2006 Author Posted August 4, 2006 James, Thanks for the assistance. Regards, Taz
Recommended Posts
Archived
This topic is now archived and is closed to further replies.