//----------2009.09.11 @Links edit start //抽出に性別と年代を追加 //$customer_query = "SELECT customers_firstname, customers_lastname, customers_email_address $customer_query = "SELECT customers_firstname, customers_lastname, customers_email_address , customers_gender , (truncate((YEAR(NOW()) - YEAR(customers_dob)) / 10,0) * 10) as age FROM " . TABLE_CUSTOMERS . " WHERE customers_id = :customersID"; //----------2009.09.11 @Links edit end $customer_query = $db->bindVars($customer_query, ':customersID', $_SESSION['customer_id'], 'integer'); $customer = $db->Execute($customer_query); if (isset($_GET['action']) && ($_GET['action'] == 'process')) { $rating = zen_db_prepare_input($_POST['rating']); $review_text = zen_db_prepare_input($_POST['review_text']); $error = false; if (strlen($review_text) < REVIEW_TEXT_MIN_LENGTH) { $error = true; $messageStack->add('review_text', JS_REVIEW_TEXT); } if (($rating < 1) || ($rating > 5)) { $error = true; $messageStack->add('review_text', JS_REVIEW_RATING); } if ($error == false) { if (REVIEWS_APPROVAL == '1') { $review_status = '0'; } else { $review_status = '1'; } $sql = "INSERT INTO " . TABLE_REVIEWS . " (products_id, customers_id, customers_name, reviews_rating, date_added, status) VALUES (:productsID, :cutomersID, :customersName, :rating, now(), " . $review_status . ")"; $sql = $db->bindVars($sql, ':productsID', $_GET['products_id'], 'integer'); $sql = $db->bindVars($sql, ':cutomersID', $_SESSION['customer_id'], 'integer'); //----------2009.09.11 @Links edit start $sex = '男性'; //DBから性別を取得 $sex_value = $customer->fields['customers_gender']; //DBから年代を取得 $age = $customer->fields['age']; //性別が女性の場合 if ($sex_value == 'f') { $sex = '女性'; } //$sql = $db->bindVars($sql, ':customersName', $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'], 'string'); //年代 + 性別を顧客名とする $sql = $db->bindVars($sql, ':customersName', $age . '代' . ' ' . $sex, 'string'); //----------2009.09.11 @Links edit end $sql = $db->bindVars($sql, ':rating', $rating, 'string'); $db->Execute($sql);