> $query="SELECT * FROM People WHERE Email = '$from1'";
> echo "3QUERY - '$query'\n";
> echo "3FROM = '$from1'\n";
> $result=mysql_query($query) or die( "Unable to view data\n" . mysql_error());
> echo "result - '$result'\n";
> 
> the above is correct, & the query is correct (compared with another
> query ive got...)
> 
> The result DOES NOT EXIST (I know there are no matches)...
> 
> However :- The '$result'  - Comes up with this :-
> 
> result - 'Resource id #9'
> 
> Now - Im assuming that "Resource id #9" means there are no records
> that match the query ?
> 
> (if so - I can work with this...) - 
> 
> Or does it mean something else ?
> 
> If there is a record, will the result be something else ?
> 
> -- 
> 
> G Stewart


Gordon,

I think this has been covered by the past posts.  However, if I can add a bit
of explanation....  When you use the mysql_query() function the matching rows
from the SELECT are placed in a memory buffer in PHP's memory space.  The
variable you call $result is not the actual data but essentially a pointer to
that memory space.  It is used for PHP's internal bookkeeping and the
mysql_fetch* functions are used to obtain the data in a desired format.

Some of the OOP classes (such as mysqli) have additional methods for obtaining
an entire result set as a large multi-dimensional array.  Procedural-style PHP
uses loops like while() to obtain each row and do something with it.

If you want to check to see how many records were found you could do something
like:

$result = mysql_query(...);
$numrows = mysql_numrows($result);

If no records are found $numrows will be 0.

James
_____


James D. Keeline
http://www.Keeline.com  http://www.Keeline.com/articles
http://Stratemeyer.org  http://www.Keeline.com/TSCollection

http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc.
Spring Semester Begins Jan 31 -- New Classes Start Every Few Weeks.


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to