\n" . " \n" . " \n" . "

\n" . " Click on one of our latest books to find out more !\n" . "

\n" . " \n" . " \n" . " \n"; /* * Put the 5 thumbnail images with links to the product_detai * page into the table. */ for ($i = 0; $i < 5; $i++) { if (!$row = db_fetch_row($res)) { break; } $ret .= " \n" . " \n" . " \n" . " \n" . " \n"; } $ret .= " \n\n"; db_freeresult($res); return($ret); } /* ---- * tpcw_product_list() * * Common part of new_product, best_sellers and search_result * item lists. * ---- */ function tpcw_product_list($res) { $n = db_numrows($res); if ($n == 0) { tpcw_error("Product list is empty"); } $ret = ""; for ($i = 0; $i < $n; $i++) { $row = db_fetch_row($res); $ret .= "\n" . "" . $row[2] . " " . $row[3] . "\n" . "" . "" . $row[1] . "\n\n"; } return($ret); } /* ---- * tpcw_new_products() * * Generate the NewProduct item list * ---- */ function tpcw_new_products($subject_string) { $res = db_new_products($subject_string); $ret = tpcw_product_list($res); db_freeresult($res); return($ret); } /* ---- * tpcw_best_sellers() * * Generate the BestSellers item list * ---- */ function tpcw_best_sellers($subject_string) { $res = db_best_sellers($subject_string); $ret = tpcw_product_list($res); db_freeresult($res); return($ret); } /* ---- * tpcw_search_result() * * Generate the SearchResult item list * ---- */ function tpcw_search_result($search_type, $search_string) { $res = db_search_result($search_type, $search_string); $ret = tpcw_product_list($res); db_freeresult($res); return($ret); } /* ---- * tpcw_order_display_lines() * * Generate the html output for the order lines in the Order Display * web page. * ---- */ function tpcw_order_display_lines($o_id) { $res = db_order_display_lines($o_id); $ret = ""; while ($row = db_fetch_row($res)) { $ol_i_id = $row[0]; $i_title = $row[1]; $i_publisher = $row[2]; $i_cost = $row[3]; $ol_qty = $row[4]; $ol_discount = (double)$row[5] * 100.0; $ol_comments = $row[6]; $ol_comments = chunk_split($ol_comments, 32, ""); $ret .= "\n" . "" . $ol_i_id . "\n" . "" . "Title: " . $i_title . "
" . "Publisher: " . $i_publisher . "\n" . "" . $i_cost . "\n" . "" . $ol_qty . "\n" . "" . $ol_discount . "%\n" . "" . $ol_comments . "\n" . "\n"; } db_freeresult($res); return($ret); } ?>