<commit_before><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Order extends CI_Model {
	public function processOrder($post)
	{
		$sql = "INSERT INTO addresses  (street, city, state, zip) VALUES (?, ?, ?, ?)";
		$values = array($post['shipStreet'], $post['shipCity'], $post['shipState'], $post['shipZip']);
		$this->db->query($sql, $values);
		$addressId = $this->db->insert_id();
		$sql = "INSERT INTO users (first_name, last_name, shipping_address_id) VALUES (?, ?)";
		$values = array($post['shipFirstName'], $post['shipLastName'], $addressId);
		$this->db->query($sql, $values);
		if ($post['isSame']=='same') {
			$billingAddressId = $this->db->insert_id();
		} else {
			$sql = "INSERT INTO addresses (street, city, state, zip) VALUES (?, ?, ?, ?)";
			$values = array($post['billStreet'], $post['billCity'], $post['billState'], $post['billZip']);
			$this->db->query($sql, $values);
			$billingAddressId = $this->db->insert_id();
			$sql = "INSERT INTO users (first_name, last_name) VALUES (?, ?)";
			$values = array($post['shipFirstName'], $post['shipLastName']);
			$this->db->query($sql, $values);
		}
		$sql = "INSERT INTO billing (card, security_code, billing_address_id) VALUES (?, ?, ?)";
		$values = array($post['card'], $post['securityCode'], $billingAddressId);
		$this->db->query($sql, $values);
		// adjust inventory
	}
	public function getAllOrders()
	{
		return $this->db->query("SELECT orders.id, users.first_name, users.last_name, orders.created_at, street, city, state, zip FROM orders JOIN users ON orders.user_id=users.id JOIN billing ON users.billing_id=billing.id JOIN addresses ON billing_address_id=addresses.id JOIN order_products ON order_products.order_id = orders.id JOIN products ON products.id=order_products.product.id")->result_array();
	}

}<commit_msg>fixed sql statement on admin orders<commit_after><?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Order extends CI_Model {
	public function processOrder($post)
	{
		$sql = "INSERT INTO addresses  (street, city, state, zip) VALUES (?, ?, ?, ?)";
		$values = array($post['shipStreet'], $post['shipCity'], $post['shipState'], $post['shipZip']);
		$this->db->query($sql, $values);
		$addressId = $this->db->insert_id();
		$sql = "INSERT INTO users (first_name, last_name, shipping_address_id) VALUES (?, ?)";
		$values = array($post['shipFirstName'], $post['shipLastName'], $addressId);
		$this->db->query($sql, $values);
		if ($post['isSame']=='same') {
			$billingAddressId = $this->db->insert_id();
		} else {
			$sql = "INSERT INTO addresses (street, city, state, zip) VALUES (?, ?, ?, ?)";
			$values = array($post['billStreet'], $post['billCity'], $post['billState'], $post['billZip']);
			$this->db->query($sql, $values);
			$billingAddressId = $this->db->insert_id();
			$sql = "INSERT INTO users (first_name, last_name) VALUES (?, ?)";
			$values = array($post['shipFirstName'], $post['shipLastName']);
			$this->db->query($sql, $values);
		}
		$sql = "INSERT INTO billing (card, security_code, billing_address_id) VALUES (?, ?, ?)";
		$values = array($post['card'], $post['securityCode'], $billingAddressId);
		$this->db->query($sql, $values);
		// adjust inventory
	}
	public function getAllOrders()
	{
		return $this->db->query("SELECT orders.id, users.first_name, users.last_name, orders.created_at, street, city, state, zip FROM orders JOIN users ON orders.user_id=users.id JOIN billing ON users.billing_id=billing.id JOIN addresses ON billing_address_id=addresses.id JOIN orders_products ON orders_products.order_id = orders.id JOIN products ON products.id=orders_products.product_id")->result_array();
	}

}
{'fraction_non_alphanumeric': 0.1937857726901063, 'fraction_numerical': 0.0, 'mean_word_length': 5.709323583180987, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3193022', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1198, 'n_words': 273}