RE: [PHP] Miscount

2001-12-14 Thread Daniel Alsén

Nope,

that didn´t help. I am baffled here.

One more interesting thing is that these two queries deliver different
results.

$num_vals = array ();
for ($i=0; $i<10; $i++)
{
  $shot_count = "SELECT COUNT(*) FROM statistik WHERE
(shooter='$shooter_login' && shot_one = '$i') ||
(shooter='$shooter_login' && shot_two = '$i') ||
(shooter='$shooter_login' && shot_three = '$i') || (shooter='$shooter_login'
&& shot_four = '$i') || (shooter='$shooter_login' && shot_five = '$i')";
  $result = mysql_query($shot_count);
  $num_vals[$i] = mysql_fetch_array($result);
}



$t = 7;
$shot_counts = "SELECT COUNT(*) FROM statistik WHERE
(shooter='$shooter_login' && shot_one = '$t') ||
(shooter='$shooter_login' && shot_two = '$t') ||
(shooter='$shooter_login' && shot_three = '$t') || (shooter='$shooter_login'
&& shot_four = '$t') || (shooter='$shooter_login' && shot_five = '$t')";


I am really stuck. Any suggestions?

- Daniel


> -Original Message-
> From: Kevin Stone [mailto:[EMAIL PROTECTED]]
> Sent: den 14 december 2001 23:53
> To: Daniel Alsén; PHP
> Subject: Re: [PHP] Miscount
>
>
> I do not know if this will solve your problem but you should enclose each
> logical query segment with parenthesies...


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Miscount

2001-12-14 Thread Kevin Stone

I do not know if this will solve your problem but you should enclose each
logical query segment with parenthesies...

$shot_counts = "SELECT COUNT(*) FROM statistik WHERE
(shooter='$shooter_login' && shot_one = '$t') ||
(shooter='$shooter_login' && shot_two = '$t') ||
(shooter='$shooter_login' && shot_three = '$t') ||
(shooter='$shooter_login' && shot_four = '$t') ||
(shooter='$shooter_login' && shot_five = '$t')";


> Hi guys,
>
> still seem to have some trouble with this code. I solved the earlier
issues,
> with your valuable help. But when i echo the results of the query it gives
> me the wrong results. I have never encountered a faulty count from mysql
> earlier. Are there any issues with the query i should consider?
>
> $t = 6;
> $shot_counts = "SELECT COUNT(*) FROM statistik WHERE
> shooter='$shooter_login' && shot_one = '$t' || shooter='$shooter_login' &&
> shot_two = '$t' || shooter='$shooter_login' && shot_three = '$t' ||
> shooter='$shooter_login' && shot_four = '$t' || shooter='$shooter_login'
&&
> shot_five = '$t'";
> $results = mysql_query($shot_counts);
> $bam = mysql_fetch_array($results);
>
> # Daniel Alsén| www.mindbash.com #
> # [EMAIL PROTECTED]  | +46 704 86 14 92 #
> # ICQ: 63006462   | +46 8 694 82 22  #
> # PGP: http://www.mindbash.com/pgp/  #
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]