Some help needed (again!)
unexpected ‘{’ in bind_param statement.
[php] include_once ($_SERVER[‘DOCUMENT_ROOT’] . ‘/cgi-bin/cnnct2mysqli.php’);
$mysqli = new mysqli($DBServer, $DBUser, $DBPass, $DBName); //this sequence req'd
if ($mysqli_connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
If(!file_exists(‘test5’))
$sql="CREATE TABLE test5(
`id` INTEGER(6) UNSIGNED NOT NULL AUTO_INCREMENT,
`amount` char(6) DEFAULT NULL,
`item_name` char(10) DEFAULT NULL,
`email` char(40) DEFAULT NULL,
`first_name` char(20),
`last_name` char(40),
`address1` char(100) DEFAULT NULL,
`address2` char(100) DEFAULT NULL,
`city` char(50) DEFAULT NULL,
`state` char(6) DEFAULT NULL,
`country` char(6) DEFAULT NULL,
`zip` char(12) DEFAULT NULL,
`mc_gross` char(6) DEFAULT NULL,
`mc_fee` char(6) DEFAULT NULL,
`tax` char(6) DEFAULT NULL,
`invoiceNo` char(20) DEFAULT NULL,
`payment_date` char(20) DEFAULT NULL,
`s_h` char(6) DEFAULT NULL,
`affiliation` char(40) DEFAULT NULL,
`e_anncmnt` char(10) DEFAULT NULL,
`hit` varchar(100) DEFAULT NULL,
`USIT_txt` char(5) DEFAULT FALSE,
`quantity` char(5) DEFAULT FALSE,
`updated` DATE,
`created` DATE,
PRIMARY KEY (invoiceNO),
INDEX (id)
)";
$amount = 0.50; //d
$item_name = 'bk'; //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_anncmnt = true; //s
$hit = 123; //i
$USIT_txt = 'true'; //s
$quantity = 1; //i 22 vars to here
$updated = ''; //s
$created = ''; //s
$stmt = $mysqli->prepare(“INSERT INTO test5 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)”)
{ //L. 70 <-- syntax error, unexpected ‘{’ … line 70
$stmt->bind_param(“dsssssssssidddisdssisiss”,$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
,updated
,created
);
$stmt->execute();
$stmt->bind_result(test5);
$stmt->close();
}
exit;[/php]
Any insights appreciated
usit