Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 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
 
Old June 6th, 2003, 12:29 AM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Not a valid MySQL result resource

Can anyone tell me why the following:
------------------------------------
function in_use($userid) {
global $user_tablename;

$query = "SELECT userid FROM $user_tablename WHERE userid = '$userid'";
$result = mysql_query($query);
if (mysql_num_rows($result)) return 0;
else return 1;
}
----------------------------------------
Returns the following error:

"Warning: mysql_num_rows(): supplied argument is
not a valid MySQL result resource"

This is from the register.php script in chapter 13
on page 469, middle of page.

 -David
 
Old June 10th, 2003, 07:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Is that your code verbatim? Or do you have @ in front of mysql_query? I only ask coz I saw this on php.net
Quote:
quote:
you can't use the @ to suppress errors when you would like to use mysql_num_rows on the variable or it will return the following error
Warning: Supplied argument is not a valid MySQL result resource
 
Old June 16th, 2003, 10:19 AM
Authorized User
 
Join Date: Jun 2003
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hawkelburry,
Please refer to the following:
http://www.wrox.com/books/errata/076...4_errata.shtml
 
Old January 29th, 2009, 09:13 AM
Registered User
 
Join Date: Jan 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

(1) The link to errata is broken
(2) There is no reference to this error in the errata

This error must be due to the code being out of date with the version of PHP I'm using on my server.

I can see why books require revision and republication and go out of date.

Looks like I have to buy the book again to the latest version.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource For Controls Muhammad Zeeshan ASP.NET 2.0 Professional 0 July 27th, 2007 04:45 AM
GridView and SQL More than one result = one result DarkForce ASP.NET 2.0 Basics 0 July 20th, 2007 04:29 AM
Calendar as a resource?? kabucek BOOK: Access 2003 VBA Programmer's Reference 0 August 8th, 2006 07:27 AM
resource not available: servlets ejmelious Apache Tomcat 0 May 19th, 2005 11:52 AM
getting a specific row from a MySQL result set Tachyon Beginning PHP 3 July 12th, 2004 11:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.