Mysql select to php string -


i have football site. player can have these results: 0, 1 or 3 (loss, draw, win)

i want see results player got in last 3 matches. want add result (should number combined 3 possible results mentioned before)

this code:

$result = mysql_query("select * events_regged result not null , registrant_name='john' order id desc limit 3") or die(mysql_error());  while($row = mysql_fetch_array( $result )) {   $form = $row['result'];  echo $form;  if ($form == '333') {echo 'won 3 times in row';} } 

the problem here 3 times number 3 , not number 333. think not need 'while' statement here.

how can it?

$result = mysql_query("select * events_regged result not null , registrant_name='john' order id desc limit 3") or die(mysql_error()); $maxwins = 0; while($row = mysql_fetch_array( $result )) {     $form = $row['result'];     if ($form==3)         $maxwins++;     else         $maxwins = 0;     if ($maxwins == 3) {         echo 'won 3 times in row';         break;     } } 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -