At 21:53 -0600 3/27/02, Alex Behrens wrote:
>This is the code I'm using and I'm a newbie so this is still a lil
>challenging for me:
>
>$numberquery = mysql_query("SELECT SUM(s.groundballs) AS grounders FROM
>stats s LEFT JOIN rahs r ON s.name = r.name WHERE (s.position =
>'$position')");

As I suspected, you're not checking the result from mysql_query()
to see whether or not it succeeded.  Do so:

if (!$numberquery)
     die ("Query failed, error is: " . mysql_error ());

You're just shooting yourself in the foot and wasting your time if
you don't check for errors.

>
>while($number=mysql_fetch_array($numberquery)){
>   printf ("Total groundballs for $position: 
>%s</font></td>",$number["grounders"]);
>}
>
>Thanks!
>--------------------------------------------
>-Alex "Big Al" Behrens
>E-mail: [EMAIL PROTECTED]
>Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
>Phone: 651-482-8779
>Cell: 651-329-4187
>Fax: 651-482-1391
>ICQ: 3969599
>Owner of the 3D-Unlimited Network:
>http://www.3d-unlimited.com
>Send News:
>[EMAIL PROTECTED]
>----- Original Message -----
>From: "Paul DuBois" <[EMAIL PROTECTED]>
>To: "Alex Behrens" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
>Sent: Wednesday, March 27, 2002 9:45 PM
>Subject: Re: SELECT frmo two tables
>
>
>>  At 20:14 -0600 3/27/02, Alex Behrens wrote:
>>  >hey guys,
>>  >
>>  >this mysql line doesn't seem to work:
>>  >
>>  >SELECT SUM(s.groundballs) AS grounders FROM stats s LEFT JOIN rahs r ON
>>  >s.name = r.name WHERE (s.position = '$position')
>>  >
>>  >why not? is there somethign wrong with my syntax? it says this error:
>>  >"Supplied argument is not a valid MySQL result resource"
>>
>>  You're leaving out details, namely the surrounding PHP code from within
>>  which you're executing this statement.  My guess is that you didn't
>>  check the result from mysql_query() to see whether or not it succeeeded.
>>  Do so, and if it fails, print the value of mysql_error() to see what it
>>  says.
>>
>>  >
>>  >Thanks!
>>  >--------------------------------------------
>>  >-Alex "Big Al" Behrens
>>  >E-mail: [EMAIL PROTECTED]
>>  >Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
>>  >Phone: 651-482-8779
>>  >Cell: 651-329-4187
>>  >Fax: 651-482-1391
>>  >ICQ: 3969599
>>  >Owner of the 3D-Unlimited Network:
>>  >http://www.3d-unlimited.com
>>  >Send News:
>>  >[EMAIL PROTECTED]
>>
>>
>
>>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail <[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to