Joost
-
Posts
2 -
Joined
-
Last visited
Posts posted by Joost
-
-
Hi,
I believe I found 2 mistakes in the (downloadable example codes)
The first is in the MySQL file in the table orders, the MySQL file states:
CREATE TABLE `orders` (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,`users_id` INT UNSIGNED NOT NULL,`transaction_id` VARCHAR(45) NOT NULL,`payment_status` VARCHAR(45) NOT NULL,`payment_amount` INT UNSIGNED NOT NULL,`date_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`id`),INDEX `date_created` (`date_created` ASC),INDEX `transaction_id` (`transaction_id` ASC),CONSTRAINT `fk_orders_users1`FOREIGN KEY (`id`)REFERENCES `users` (`id`)ON DELETE NO ACTIONON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARSET=utf8;The constraint states the foreign key is 'id' and references to table 'users' id, however the id in table orders is auto incremented. Should it not be FOREIGN KEY (users_id) with REFERENCES `users` (`id`)??
The second is on page 173 (Chapter Creating the IPN script)The query states: $q = "INSERT INTO orders (user_id, transaction_id, payment_status, payment_amount) VALUES ($uid, '$txn_id', '$status', $amount)";
However I believe user_id should be users_idI am probably be wrong because even with these changes I just cant get the IPN script to work, i found a alternative script that does work though.
Errors?
in Effortless E-Commerce with PHP and MySQL (2nd Edition)
Posted
No problem, thx for the book and available example codes.
Found another one
In the page.php file for recording the history the example files state:
the require(MYSQL); should be placed before the header.html part because the header.html file makes a MySQL query for categories and the require mysql file is not in that file.
page 394 updating register.php and page 395 updating add_page.php with prepared statement
mysqli_stmt_close(); should be mysqli_stmt_close($stmt);