 |
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
 | This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 9th, 2010, 08:20 AM
|
|
Authorized User
|
|
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
more errors from chapter 15 - ecomm_checkout3.php
First of all, in order to even get to this page, you will need to add a "submit" button to the form in ecomm_checkout2.php, since the geniuses who wrote the book forgot to add it.
When you attempt to display the page ecomm_checkout3.php, you will get a mysql error message, because the value of the variable $cost_subtotal is empty. They attempt to set the value in the following lines of code:
// retrieve subtotal
$query = 'SELECT
SUM(price * order_qty) AS cost_subtotal
FROM
ecomm_order_details d JOIN ecomm_products p ON
d.product_code = p.product_code
WHERE
order_id = ' . $order_id;
$result = mysql_query($query, $db) or (mysql_error($db));
$row = mysql_fetch_assoc($result);
extract($row);
This does not work. If you change it to the following, it works fine and your page should load with the proper values in all fields:
//retrieve subtotal
$query = 'SELECT
SUM(price * order_qty) AS cost_subtotal
FROM
ecomm_order_details d JOIN ecomm_products p ON d.product_code = p.product_code
WHERE
order_id = ' . $order_id;
$result = mysql_query($query, $db) or die(mysql_error($db));
$row = mysql_fetch_array($result);
$cost_subtotal = $row['cost_subtotal'];
|
|

September 8th, 2010, 10:47 AM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Thanks Boboneil.. very useful!!
Perhaps you have saw the error in the Chp12.. I've open a thread about that..
I ask myself: but the people who wrote this book.. didn't TRY all the script??? I'ts unbelivable...
(sorry for the english but i'm Italian..)
|
|

September 8th, 2010, 01:45 PM
|
|
Authorized User
|
|
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
By the time I got to chapter 16 I gave up trying to fix the errors. There is so much code involved in that chapter that it would take forever to fix it. I have moved on to a more advanced PHP book - "PHP and MYSQL Create - Modify - Reuse". This one is from Wrox also and it seems to be pretty good, though I am having problems with some of the code in it.
I saw your post about chapter 12, but I could not recreate the problem, so I don't know how to resolve it.
|
|

September 8th, 2010, 03:29 PM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
|
|
I understand, thanks however..
Just i terminate the book i look for something more "precise",but i will take a look to "PHP and MYSQL Create - Modify - Reuse".. is like a sequel of "BOOK: Beginning PHP 6, Apache, MySQL 6" ?? If yes seems interesting
|
|

September 8th, 2010, 04:19 PM
|
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Ok Ok i solve it! More simple than i thought!
There is the original portion of code that update the user info
PHP Code:
$query = 'UPDATE site_user u, site_user_info SET username = "' . mysql_real_escape_string($username, $db) . '", first_name = "' . mysql_real_escape_string($first_name, $db) . '", last_name = "' . mysql_real_escape_string($last_name, $db) . '", email = "' . mysql_real_escape_string($email, $db) . '", city = "' . mysql_real_escape_string($city, $db) . '", state = "' . mysql_real_escape_string($state, $db) . '", hobbies = "' . mysql_real_escape_string(join(', ', $hobbies), $db) . '" WHERE u.user_id = ' . $user_id;
and there is the modified code, now it works
PHP Code:
$query = 'UPDATE site_user u, site_user_info i SET username = "' . mysql_real_escape_string($username, $db) . '", first_name = "' . mysql_real_escape_string($first_name, $db) . '", last_name = "' . mysql_real_escape_string($last_name, $db) . '", email = "' . mysql_real_escape_string($email, $db) . '", city = "' . mysql_real_escape_string($city, $db) . '", state = "' . mysql_real_escape_string($state, $db) . '", hobbies = "' . mysql_real_escape_string(join(', ', $hobbies), $db) . '" WHERE u.user_id = ' . $user_id . ' AND i.user_id = ' . $user_id;
very very simple  now i copy it in the right thread
Last edited by DMatt; September 8th, 2010 at 04:22 PM..
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| PHP 4 chapter 15 |
angelic_scars |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
0 |
November 29th, 2006 08:36 AM |
| chapter 15 checkout3.php problem |
derrida |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
November 12th, 2006 10:11 AM |
| chapter 15 cart.php |
pink |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
July 18th, 2005 05:45 PM |
| Chapter 15 - functions.php question |
buzzuh |
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 |
1 |
September 7th, 2004 08:31 AM |
| chapter 15 adv_mail.php |
ncliche |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
2 |
January 14th, 2004 03:43 PM |
|
 |