In reference to...
http://www.larryullman.com/2010/12/28/rewriting-the-e-commerce-stored-procedures-with-standard-php-mysql-3-chapter-10/
$r = mysqli_query($dbc, "CALL add_customer('$e', '$fn', '$ln', '$a1', '$a2', '$c', '$s', $z, $p, @cid)");
// Confirm that it worked:
if ($r) {
// Retrieve the customer ID:
$r = mysqli_query($dbc, 'SELECT @cid');
if (mysqli_num_rows($r) == 1) {
list($_SESSION['customer_id']) = mysqli_fetch_array($r);
with
$r = mysqli_query($dbc, "INSERT INTO customers VALUES (NULL, '$e', '$fn', '$ln', '$a1', '$a2', '$c', '$s', $z, $p, NOW())");
// Confirm that it worked:
if (mysqli_num_rows($r) == 1) {
// Retrieve the customer ID:
$_SESSION['customer_id'] = mysqli_insert_id($r);
I did the replace, and also noticed you must comment out a } after the exit();
Following correcting that error, I continuously am getting the following error
An error occurred in script '/home/paintedb/public_html/checkout.php' on line 145:
mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given
Line 145 consists of the replacement mysqli_num_rows instructed to change
if (mysqli_num_rows($r) == 1) {
I also am getting an error on line 161
trigger_error('Your order could not be processed due to a system error. We apologize for the inconvenience.');
Any advice would be appreciated.
Greg
Server info
Apache version 2.2.17
PHP version 5.2.16
MySQL version 5.1.52
Architecture i686
Operating system linux