PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE `aq_contract_estimate`( `vendorId` varchar(64), `name` varchar(64), `projectId` varchar(64), `exportId` varchar(64), `total_freight` varchar(64), `total_taxable` varchar(64), `total_nontaxable` varchar(64), `total_credit_taxable` varchar(64), `total_credit_nontaxable` varchar(64) );
Copy Clear
Copy Format Clear
<?php $vendorId = "b4ff9670-3481-4adc-9c4c-3c0b8f07d174"; $name = "Riverside"; $projectId = "827c879c-8dd6-4738-85f8-c14da2c743b8"; $exportId = "53067"; $total_freight = 465; $total_taxable = 17853; $total_nottaxable = 0; $total_credit_taxable = 0; $total_credit_nontaxable = 0; function clean($str) { return $str; } $questions[] = "(?,?,?,?,?,?,?,?,?)"; $arguments[] = clean($vendorId); $arguments[] = clean($name); $arguments[] = clean($projectId); $arguments[] = clean($exportId); $arguments[] = filter_var(clean($total_freight), FILTER_VALIDATE_INT); $arguments[] = filter_var(clean($total_taxable), FILTER_VALIDATE_INT); $arguments[] = filter_var(clean($total_nontaxable), FILTER_VALIDATE_INT); $arguments[] = filter_var(clean($total_credit_taxable), FILTER_VALIDATE_INT); $arguments[] = filter_var(clean($total_credit_nontaxable), FILTER_VALIDATE_INT); $connection = &$pdo; if(!empty($questions) && !empty($arguments) && count($questions) == count($arguments) / 9){ $statement = $connection->prepare("INSERT INTO `aq_contract_estimate`(`vendorId`, `name`, `projectId`, `exportId`, `total_freight`, `total_taxable`, `total_nontaxable`, `total_credit_taxable`, `total_credit_nontaxable`) VALUES " . implode(", ", $questions)); $statement->execute($arguments); $statement->closeCursor(); } $query = "SELECT * FROM `aq_contract_estimate`;"; $stmt = $pdo->prepare($query); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); print_r($row);
Show:  
Copy Clear