目的
CREATE
TABLE
AccountsReceivables
invoice_id
及相关参数(例如customer_id
,CONSTRAINTS
等)。 确保将business_unit
添加到invoice_terms
和CREATE TABLE customers
(id INT NOT NULL PRIMARY KEY,
global_risk_partner varchar(32) NOT NULL
);
以帮助标准化用户输入
APPROACH / SCHEMA
CUSTOMER表
CREATE TABLE AccountsReceivable
(upload_date TIMESTAMP NOT NULL,
invoice_id INT NOT NULL,
PRIMARY KEY(upload_date, invoice_id),
/*Pull in customer_id from another table */
customer_id INT NOT NULL,
FOREIGN KEY (customer_id) REFERENCES customers(id),
/*Add constraints to standardize which business unit is responsible for invoice */
business_unit varchar(16) NOT NULL,
CONSTRAINT chk_business_unit CHECK (business_unit in ('PLP', 'DSI', 'JIMCO', 'PATTON', 'THRO', 'FRANCE', 'SWEDEN', 'UK', 'POLAND', 'GERMANY', 'HOLLAND', 'PINNACLE', 'NBUSA TN', 'NBUSA IL')),
invoice_value float(2) NOT NULL,
invoice_date DATE NOT NULL,
/*Add constraints to standardize payment terms */
invoice_terms INT NOT NULL,
CONSTRAINT chk_invoice_terms CHECK (invoice_terms IN (30, 60, 90, 120)) /* dropdown list of invoice terms */
);
ACCOUNTSRECEIVABLE表
INSERT INTO customers VALUES
(321, 'WALMART');
INSERT INTO AccountsReceivable VALUES
(CURRENT_DATE(), 123, 321, 'LP', 100.50, '2016-01-20', 30); /* This should throw an ERROR since 'LP' isn't a valid business_unit */
将值插入CUSTOMERS和ACCOUNTRECEIVABLE表
INSERT
问题
business_unit
CONSTRAINT
INSERT...'LP'
之外的LP
(即CONSTRAINT chk_business_unit..
function loadcontent() {
var id = $('.catslide>.swiper-wrapper>.swiper-slide-active').attr('data-id');
$.ajax({
type: "POST",
url: "../showthis.php",
data: {
id: id,
rand: 1
},
datatype: 'json',
success: function(data) {
var height = $('#slideadv').height();
$('#slideadv').height(height);
mySwiper.removeAllSlides();
mySwiper.appendSlide(data);
mySwiper.update();
}
});
}
isn&#39 ; $query3 =
"SELECT * FROM adv_items WHERE category_id='$id' AND adv_type='Standard' AND hide='show' ORDER BY RAND()";
$advst = $db - > prepare($query3);
$advst - > fetchAll(PDO::FETCH_ASSOC);
$advst - > execute();
$text = '';
foreach(array_chunk($advst - > fetchAll(), 4, true) as $advsts) {
{
echo '<div class="swiper-slide">';
foreach($advsts as $kicks) {
echo '<div class="col-md-6 advertising">';
echo '<div class="company-logo"><img src="./'.$kicks['clogo'].
'" alt="..."></div>';
echo '<div class="company-contcs"><p class="company-title">'.$kicks[
'cname'].
'</p><a href="tel:'.$kicks['phone1'].
'">Телефон: '.$kicks['phone1'].
'</a><a href="'.$kicks['curl'].
'">'.$kicks['curl'].
'</a></div>';
echo '<p class="company-desc">'.substr($kicks['text'], 0, 600).
'</p>';
echo "</div>";
}
echo '</div>';
}
}
中的t。 如何确保所有用户输入都是标准化的,以便表格仅包含有效参数? 参考