<?php
/*
$nocol=5; //For the backend 
$nocoldetaildisplay=5;

$jackpotid=1;   //1
$luckyid=2;   //2
$giftid=3;   //3
$consolationid=4;  //4
$participationid=5; //5




$jackpotlimit=10;
$luckylimit=10;
$giftlimit=30;
$consolationlimit=30;
$participationlimit=50;
$digitclassiclimit=23;
$jackpot=array();   //1
$lucky=array();   //2
$gift=array();   //3
$consolation=array();  //4
$participation=array(); //5
$digitclassic=array();  //6

function get_bs_resultext($bstypeid){
switch ($bstypeid){
case 1:
	$st='won  Jackpot Prizes ' ;
break;
case 2:
	$st='won Lucky Prizes' ;
break;
case 3:
	$st='won  Gift Prizes ' ;
break;
case 4:
	$st='won  Consolation Prizes ' ;
break;
case 5:
	$st='won  Participation Prizes ' ;
break;                              


}
return $st;

}


function get_bslottery_no($bslotteryid,$pryzetype){
$resultnumber=array();
	$sql = "SELECT prizenumber  
				FROM  bslotteryno WHERE bslotteryid='$bslotteryid' and  pryzetype ='$pryzetype'" ; $result = mysql_query($sql); 
	if(mysql_num_rows($result)>0){ 
	 while ($row = mysql_fetch_object($result)){
	 $resultnumber[]=$row->prizenumber;
	 }
	 }

return $resultnumber;
}






function insert_bslottery($bslotteryid,$values,$type){
for($i=0;$i<count($values);$i++){		
		
		if(strlen($values[$i])>0){	
					$sql_data_array = array(						     
						'bslotteryid'=>$bslotteryid,						
						'pryzetype' =>$type,
						'prizenumber'  =>$values[$i]		
						);
				tep_db_perform(" bslotteryno", $sql_data_array,"insert");
			}
		}
							

}


function draw_table_result($bslotteryid,$pryzetype,$nocol){

$st='';
 	$sql = "SELECT prizenumber  
 			FROM  bslotteryno WHERE bslotteryid='$bslotteryid' and  pryzetype ='$pryzetype'" ;
					
					 $sql = $sql . " ORDER BY id ";

					 $result = mysql_query($sql); 
if(mysql_num_rows($result)>0){ 
		$i=0;			
$st.='<table width="100%"  border="0" cellspacing="2" cellpadding="4" align="center">';
 while ($row = mysql_fetch_object($result)){


if($pryzetype==1 || $pryzetype==2)
 $resultnumber=get_bs_lotterydisplay($row->prizenumber);
else $resultnumber=$row->prizenumber;
		
						if(($i%$nocol)==0)
								$st.='<tr >';
					$st.='<td align="center" class="copyright" >'.$resultnumber.'</td>';				 
						if(($i%$nocol)==($nocol-1))
								$st.='</tr>';
$i++;
}
 
$st.='</table>';
}else{
$st='No result found';
}
return $st;


}


*/












function get_table_field($field_name,$field_value,$limit,$nocol){
$st='';
$st.='<table width="100%"  border="0" cellspacing="0" cellpadding="2">';
 for($i=0;$i<$limit;$i++){			
if(count($field_value)>$i)
	$val=$field_value[$i];
else
$val='';	
			if(($i%$nocol)==0)
				$st.='<tr>';

if(($i+1)<10)
$num='&nbsp;&nbsp;'.($i+1);
else
$num=($i+1);
$st.='<td>'.$num.'<input name="'.$field_name.'" type="text" class="inputBOX" maxlength="7"  value="'.$val.'" ></td>';
 
if(($i%$nocol)==($nocol-1))
	$st.='</tr>';
}

 
$st.='</table>';

return $st;

}

?>