Finally, I’m pleased to report that my several test scripts are working. Thanks to your help.
When I put the full table into the last working test script I get ‘syntax error, unexpected T_STRING’. This error I’m rather familiar with. However, in this case there are no missing ‘;’, so I focused on the db definition. As far as I can tell it looks OK. However, the compiler doesn’t seem to agree. Can anyone see the problem?
<?php // Apr2013_En/TmpTestFilesApr2013_En/TmpTestFiles/CreaTbl_test5.php
include_once ($_SERVER['DOCUMENT_ROOT'] . '/cgi-bin/cnnct2mysqli.php');
$mysqli = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
//error: 'syntax error, unexpected T_STRING ' L.10 is the following line
CREATE TABLE IF NOT EXISTS `ntelleckdb`.`test5`
(
`id` INT(6) unsigned NOT NULL AUTO_INCREMENT,
`amount` char(6) YES NULL DEFAULT '',
`item_name` varchar(10) YES NULL,
`email` varchar(40) YES NULL,
`first_name` varchar(20),
`last_name` varchar(40),
`address1` varchar(100) YES NULL,
`address2` varchar(100) YES NULL,
`city` varchar(50) YES NULL,
`state` varchar(6) YES NULL,
`country` varchar(6) YES NULL,
`zip` varchar(12) YES NULL,
`mc_gross` varchar(6) YES NULL,
`mc_fee` varchar(6) YES NULL,
`tax` varchar(6) YES NULL,
`invoiceNo` varchar(20) YES NULL,
`payment_date` varchar(20) YES NULL,
`s_h` varchar(6) YES NULL,
`affiliation` varchar(40) YES NULL,
`e_anncmnt` varchar(10) YES NULL,
`hit` varchar(100) YES NULL,
`USIT_txt` unum('True','False') YES FALSE,
`updated` timestamp DATE,
`created` timestamp YES 0000-00-00 00:00:00,
PRIMARY KEY (invoiceNO),
INDEX (id)
) //26 var,
$amount = 1.00; //d
$item_name = 'book'; //s
$email = '
[email protected]'; //s
$first_name = 'Fname'; //s
$last_name = 'LongerLastNames'; //s
$address1 = 'Addr01'; //s
$address2 = 'Addr02'; //s
$city = 'cty'; //s
$state = 'MI'; //s
$country = 'US'; //s
$zip = 48138; //i
$mc_gross = 0.00; //d
$mc_fee = 0.00; //d
$tax = 0.00; //d
$invoiceNo = 140630; //i
$payment_date = 'yyyy-mm-dd'; //s
$s_h = 0.00; //d
$affiliation = 'retired'; //s
$e_announcement = true; //s
$hit = 123; //i
$USIT_txt = 'true'; //s
$quantity = 1; //i 22 vars to here
$stmt = $mysqli->prepare("INSERT INTO test5 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
//var_dump($stmt);
$stmt->bind_param('dsssssssss iddd is dss is i', `$amount`, `$item_name`, `$email`, `$first_name`, `$last_name`,
`$address1`, `$address2`, `$city`, `$state`, `$country`, `$zip`, `$mc_gross`, `$mc_fee`, `$tax`, `$invoiceNo`,
`$payment_date`, `$s_h`, `$affiliation`, `$e_anncmnt`, `$hit`, `$USIT_txt`, `$quantity`);
$stmt->execute();
$atmt->close();
$mysqli->close();
exit;
?>
This is where my original problem began.
Thanks for your interest.
usit