Forum Moderators: coopster
if (!($stmt = $mysqli->prepare($theinsert))) {
echo "Prepare failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
if (!$stmt->bind_param("issssssssssisssssssssssssssssssssss", $PID, $fname, $lname, $title, $mrank, $website, $linkedin, $twitter, $facebook, $photo, $cv, $speaker, $speaktopics, $stafforfac, $startdate, $building, $room, $phone, $email, $courses, $college, $program, $institution1, $year1, $degree1, $institution2, $year2, $degree2, $institution3, $year3, $degree3, $assocs, $awards, $pubs, $interests)) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
printf("Error message: %s\n", mysqli_error($mysqli)); This gives me nothing.
$theinsert = "INSERT INTO myprofiles(
PID,
fname,
lname,
title,
mrank,
website,
linkedin,
twitter,
facebook,
photo,
cv,
speaker,
speaktopics,
stafforfac,
startdate,
building,
room,
phone,
email,
courses,
college,
program,
institution1,
year1,
degree1,
institution2,
year2,
degree2,
institution3,
year3,
degree3,
assocs,
awards,
pubs,
interests
)
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
error_reporting(E_ALL ^ E_STRICT);
ini_set('display_errors','1'); $mysqli->affected_rows date_default_timezone_set('America/New_York');
error_reporting(E_ALL ^ E_STRICT);
ini_set('display_errors','1');
$mysqli = mysqli_init();
if (!$mysqli) {
die('mysqli_init failed');
}
if (!$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')) {
die('Setting MYSQLI_INIT_COMMAND failed');
}
if (!$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
die('Setting MYSQLI_OPT_CONNECT_TIMEOUT failed');
}
if (!$mysqli->real_connect("xx", "xx", "xx", "xx")) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
if($_POST['form_id'] == '1'){
if($_POST['_wp_http_referer'] == "/the-form/") {
$fname = $mysqli->real_escape_string( $_POST['vfb-5'] );
$theinsert = "INSERT INTO myprofiles( fname ) VALUES(?)";
if (!($stmt = $mysqli->prepare($theinsert) {
echo "Prepare failed: (" . $stmt->errno . ") " . $stmt->error;
}
if (!$stmt->bind_param("s", $fname)) {
echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
}
printf( $mysqli->affected_rows ); // echos 1
printf ( $stmt->error ); // no output
echo mysqli_error($mysqli); // no output
// echo gettype ($fname); // string
echo '<br/>' . $mysqli->host_info . "\n"; // echos Localhost via UNIX socket
}
else {
header('Location: '.home_url());
exit;
}
$mysqli->close();
}
else {
header('Location: '.home_url());
exit;
}
$mysqli->options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0')