bac3 Posted November 29, 2003 Posted November 29, 2003 In shoppingcart.php, After products_name defined, i add the following lines to display a new field in table products; $str1 = 'select product_unit from '.TABLE_PRODUCTS.' where products_id ='.$products[$i]['id']; $query = tep_db_query("$str1"); $product_unit = tep_db_fetch_array($query); What's wrong is above code Next to quantity input box, i add following line $info_box_contents[$cur_row][] = array( 'align' => 'center', 'params' => 'class="productListing-data"valign="top"', 'text' => $product_unit); But the product_unit return a string "Array", Why? oscommerce.com.hk
Guest Posted November 29, 2003 Posted November 29, 2003 Try this: $str1 = tep_db_query("select product_unit from " . TABLE_PRODUCTS . " where products_id ='" . $products[$i]['id'] . "'"); $query = tep_db_fetch_array($str1); $product_unit = $query['product_unit']; Matti
bac3 Posted December 1, 2003 Author Posted December 1, 2003 Thanks for reply first, but it returns nothing. Finally i use a poor coding to finish it @ $db = mysql_pconnect ("localhost", "root", ""); if (!$db) { echo" Error: Could not connect to database. Please try again later."; exit; } mysql_select_db("testing"); $str1 = 'select product_unit from products where products_id ='.$products[$i]['id']; $result = mysql_query($str1); $row = mysql_fetch_array($result, MYSQL_BOTH); product_unit2 = $row[0]; oscommerce.com.hk
bac3 Posted December 1, 2003 Author Posted December 1, 2003 How to rewrite it in oscommerce by its prefined function? oscommerce.com.hk
Recommended Posts
Archived
This topic is now archived and is closed to further replies.