 |
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
|
|
|

September 7th, 2010, 05:29 PM
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
|
|
Chp 12: update_user.php doesn't works
Hi
I've a problem with the original update_user.php file download here..
The file must be update the informations of a "single" user, set by the user_id..
Instead when i press the "update" button ALL the user are updated!!!
Now i've my 3 users with the same informations! same first name, last name, email, city, state and hobbies! This is a very big problem..
How can i fix the problem??
|

September 8th, 2010, 04:23 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 
|

October 9th, 2010, 03:57 PM
|
Authorized User
|
|
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Thanks for solving this. I just ran accross the same error today. Everytime I updated a user it updated every other user with the same info.
|

October 9th, 2010, 04:04 PM
|
Authorized User
|
|
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
..but I am getting this errors:
Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\xampp\htdocs\Tutorials\wrox\update_user.php on line 57
Warning: mysql_free_result() expects parameter 1 to be resource, null given in C:\xampp\htdocs\Tutorials\wrox\update_user.php on line 61
|

October 9th, 2010, 04:12 PM
|
Authorized User
|
|
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
oops...just solved those errors. I forgot the code to submit the query.
|

October 17th, 2010, 04:30 PM
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
|
|
to many errors in this book... 
|

October 17th, 2010, 06:06 PM
|
Authorized User
|
|
Join Date: Sep 2010
Posts: 20
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
DMatt - did you work through the later chapters? The online store and the bulletin board? I'm wondering it if it even worth the trouble.
|

October 18th, 2010, 05:36 PM
|
Authorized User
|
|
Join Date: Jun 2010
Posts: 36
Thanks: 1
Thanked 1 Time in 1 Post
|
|
I've ended the book, the 2 final chapters have some errors.. i don't remember exactly wich are.. however i suggest you finish the book, is interesting
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Chp 12: Problems with htpasswd |
DMatt |
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 |
1 |
August 3rd, 2010 11:53 AM |
Chapter 12 update_user.php issues |
sgtwwilson |
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 |
1 |
May 7th, 2009 08:46 PM |
Chp.12 SqlDataSource.SelectCountCommand ??? |
studen77 |
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 |
4 |
March 7th, 2007 02:50 PM |
Chp 12, common_db.inc & userviewer.php reques |
jaymax |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
1 |
February 1st, 2006 05:18 PM |
Chp 12 - userviewer.php problems w/ hyperlinks |
jaymax |
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 |
2 |
July 10th, 2003 04:54 PM |
|
 |