intring parse error

anilson1

New Member
Messages
45
Reaction score
0
Points
0
any help with that?

Parse error: syntax error, unexpected $end in /home/anilson1 xxx on line 307

On line 307 I have ?>

Can anyone tell me why I have this unexpected $end error?
 

crisp

New Member
Messages
85
Reaction score
0
Points
0
Posting the script might help, at a guess, a missing ; or } will be to blame though
 

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
Your missing a ; or } in your script, post when you have it fixed or post the script.
 

anilson1

New Member
Messages
45
Reaction score
0
Points
0
here is the code:
------------------

<?php
// this program does:
// - insert the 7 sorted numbers into DB on table result
// - check for match between the 7 numbers and the playtable in DB
// - create a txtfile of the entire DB
// - update playtable
// - update grouptable

$winners="";
$sortedspvalues = $_POST["getSuperValue"];
$gedate = $_POST["sortedate"];

$planingdate = explode("-",$gedate);

$plainfiledateS="dbcopy".$planingdate[0].$planingdate[1].$planingdate[2]."S7.txt";

$singlesortedvaluesSuper=explode("-",$sortedspvalues);
sort($singlesortedvaluesSuper);

// Connect to server and select databse.
mysql_connect("localhost", "anilson1", "anicardoso001")or die("cannot connect");
mysql_select_db("anilson1_olgDB")or die("cannot select DB");

insideproccessingsp($singlesortedvaluesSuper,$sortedspvalues,$plainfiledateS);


function insideproccessingsp($a,$b,$c)
{
$sqr121="SELECT * FROM PlayTableS7";
$result121=mysql_query($sqr121);
$counter1=mysql_num_rows($result121);

if($counter1>0)
{//get values from database and puts into an array
while ($line = mysql_fetch_array($result121,MYSQL_BOTH))
{//array that gets numbers from each row of the database
$arraygetValueFromDB[0]=$line["Num1"];//represents number 1
$arraygetValueFromDB[1]=$line["Num2"];//represents number 2
$arraygetValueFromDB[2]=$line["Num3"];//represents number 3
$arraygetValueFromDB[3]=$line["Num4"];//represents number 4
$arraygetValueFromDB[4]=$line["Num5"];//represents number 5
$arraygetValueFromDB[5]=$line["Num6"];//represents number 6
$arraygetValueFromDB[6]=$line["Num7"];//represents number 7

$groupcode=$line["GroupName"];
$refcode=$line["RefNum"];
if(!in_array("$groupcode",$grouparray))
{
$grouparray[]=$groupcode;
$groupLengtharray[$groupcode]=1;
}
else
{
$groupLengtharray[$groupcode]++;
}
$comparison11 = array_diff($a,$arraygetValueFromDB);
if($comparison11==Array())
{ $winners= $winners.$line['GroupName']."-Slip ".$line['SlipNum']."-Draw ".$line['DrawNum'].","; }

$printFileName1 = $c;
$printFileHandle1 = fopen($printFileName1, "a") or die("Can not (re)open txtfile");
fwrite($printFileHandle1,$line['PersonalID']."||".$line['GroupName']."||Slip ".$line['SlipNum']."||Draw ".$line['DrawNum']."||".$line['Num1']."||".$line['Num2']."||".$line['Num3']."||".$line['Num4']."||".$line['Num5']."||".$line['Num6']."||".$line['Num7']."||".$sortedspvalues."\n");
fclose($printFileHandle1);

if(!($line["WeeksLeft"]==0))
{mysql_query("DELETE FROM PlayTableS7 WHERE GroupName='$groupcode' AND RefNum='$refcode'");
}
else
{$oneweekless = $line['WeeksLeft'] - 1;
myql_query("UPDATE PlayTableS7 SET WeeksLeft='$oneweekless' WHERE GroupName='$groupcode' AND RefNum='$refcode'");}

}
}
updategroupsp($grouparray,$groupLengtharray);
mysql_query("UPDATE ResultTable SET RecordFile='$c', SixNumWinners='$winners', SortedBalls='$b' WHERE SortedBalls='' AND GameType='S 7'");
unset($arraygetValueFromDB);
}




function updategroupsp($group,$elementsInGroup)
{
foreach($group as $valueg)
{
$deframentedgroup=explode(" ",$valueg);
$Resqr=mysql_query("SELECT * FROM GroupTableS7 WHERE GroupName='$deframentedgroup[1]'");
$groupCounting = mysql_num_rows($Resqr);
if($groupCounting>0)
while($groupline=mysql_fetch_array($groupCounting,MSQL_BOTH))
{

if($groupline['Status']=="Complete")
{if($groupline['Class']="6 Months")
{if($elementsInGroup[$valueg]<100)
{mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");}}
elseif($groupline['Class']="3 Months")
{if($elementsInGroup[$valueg]<100)
{mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");}}
elseif($groupline['Class']="1 Month")
{if($elementsInGroup[$valueg]<100)
{mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");}}
else
{$weekslef = 1;
$newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
mysql_query("UPDATE GroupTableS7 SET Status='Open',Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");}}
else
{if($groupline['Class']="6 Months")
{$weekslef = 26;
$newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");}
elseif($groupline['Class']="3 Months")
{$weekslef = 13;
$newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");}
elseif($groupline['Class']="1 Month")
{$weekslef = 4;
$newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");}
else
{if($groupline['GroupName']>10)
{mysql_query("DELETE FROM GroupTableS7 WHERE GroupName='$deframentedgroup[1]'");}}
}
}
}


function createReferenceValue($groupy,$weeky,$duedaty)
{
$md=explode("-",$duedaty);
$selector = randomgroupselection();
$a="GR0".$groupy;
$b="wk".$weeky;
$c=$md[0]."D".$md[2];
if($selector==1)
{$refenciator=$a.$b.$c."A";}
elseif($selector==2)
{$refenciator=$b.$a."B".$c;}
else
{$refenciator=$c.$a."C".$b;}
return $refenciator;
}

//This function create random values
//to select group reference
function randomgroupselection()
{
$nu=rand(1,3);
return $nu;
}

mysql_close();
header("location:http://cavuanzakikolo.x10hosting.com/management.php");
?>
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
please post code with the proper tags (php is
PHP:
, html is [html] and any other code is [code]).

clean code is easier to read and debug than messy code.  using spaces and tabs are recommended to make code easier to understand by not only others, but yourself as well.

[php]<?php
// this program does:
// - insert the 7 sorted numbers into DB on table result
// - check for match between the 7 numbers and the playtable in DB
// - create a txtfile of the entire DB
// - update playtable
// - update grouptable

$winners="";
$sortedspvalues = $_POST["getSuperValue"];
$gedate = $_POST["sortedate"];

$planingdate = explode("-",$gedate);

$plainfiledateS="dbcopy".$planingdate[0].$planingdate[1].$planingdate[2]."S7.txt";

$singlesortedvaluesSuper=explode("-",$sortedspvalues);
sort($singlesortedvaluesSuper);

// Connect to server and select databse.
mysql_connect("localhost", "anilson1", "anicardoso001")or die("cannot connect");
mysql_select_db("anilson1_olgDB")or die("cannot select DB");

insideproccessingsp($singlesortedvaluesSuper,$sort edspvalues,$plainfiledateS);


function insideproccessingsp($a,$b,$c)
{
  $sqr121="SELECT * FROM PlayTableS7";
  $result121=mysql_query($sqr121);
  $counter1=mysql_num_rows($result121);

  if($counter1>0)
  {//get values from database and puts into an array
    while ($line = mysql_fetch_array($result121,MYSQL_BOTH))
    {//array that gets numbers from each row of the database
      $arraygetValueFromDB[0]=$line["Num1"];//represents number 1
      $arraygetValueFromDB[1]=$line["Num2"];//represents number 2
      $arraygetValueFromDB[2]=$line["Num3"];//represents number 3
      $arraygetValueFromDB[3]=$line["Num4"];//represents number 4
      $arraygetValueFromDB[4]=$line["Num5"];//represents number 5
      $arraygetValueFromDB[5]=$line["Num6"];//represents number 6
      $arraygetValueFromDB[6]=$line["Num7"];//represents number 7

      $groupcode=$line["GroupName"];
      $refcode=$line["RefNum"];
      if(!in_array("$groupcode",$grouparray))
      {
        $grouparray[]=$groupcode;
        $groupLengtharray[$groupcode]=1;
      }
      else
      {
        $groupLengtharray[$groupcode]++;
      }
      $comparison11 = array_diff($a,$arraygetValueFromDB);
      if($comparison11==Array())
      {
        $winners= $winners.$line['GroupName']."-Slip ".$line['SlipNum']."-Draw ".$line['DrawNum'].",";
      }

      $printFileName1 = $c;
      $printFileHandle1 = fopen($printFileName1, "a") or die("Can not (re)open txtfile");

      fwrite($printFileHandle1,$line['PersonalID']."||".$line['GroupName']."||Slip ".$line['SlipNum']."||Draw ".$line['DrawNum']."||".$line['Num1']."||".$line['Num2']."||".$line['Num3']."||".$line['Num4']."||".$line['Num5']."||".$line['Num6']."||".$line['Num7']."||".$sortedspvalues."\n");
      fclose($printFileHandle1);

      if(!($line["WeeksLeft"]==0))
      {
        mysql_query("DELETE FROM PlayTableS7 WHERE GroupName='$groupcode' AND RefNum='$refcode'");
      }
      else
      {
        $oneweekless = $line['WeeksLeft'] - 1;
        mysql_query("UPDATE PlayTableS7 SET WeeksLeft='$oneweekless' WHERE GroupName='$groupcode' AND RefNum='$refcode'");
      }
    }
  }
  updategroupsp($grouparray,$groupLengtharray);
  mysql_query("UPDATE ResultTable SET RecordFile='$c', SixNumWinners='$winners', SortedBalls='$b' WHERE SortedBalls='' AND GameType='S 7'");
  unset($arraygetValueFromDB);
}




function updategroupsp($group,$elementsInGroup)
{
  foreach($group as $valueg)
  {
    $deframentedgroup=explode(" ",$valueg);
    $Resqr=mysql_query("SELECT * FROM GroupTableS7 WHERE GroupName='$deframentedgroup[1]'");
    $groupCounting = mysql_num_rows($Resqr);
    if($groupCounting>0)
    {
      while($groupline=mysql_fetch_array($groupCounting, MSQL_BOTH))
      {

        if($groupline['Status']=="Complete")
        {
          if($groupline['Class']="6 Months")
          {
            if($elementsInGroup[$valueg]<100)
            {
              mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");
            }
          }
          elseif($groupline['Class']="3 Months")
          {
            if($elementsInGroup[$valueg]<100)
            {
              mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");
            }
          }
          elseif($groupline['Class']="1 Month")
          {
            if($elementsInGroup[$valueg]<100)
            {
              mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");
            }
          }
          else
          {
            $weekslef = 1;
            $newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
            mysql_query("UPDATE GroupTableS7 SET Status='Open',Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
          }
        }
        else
        {
          if($groupline['Class']="6 Months")
          {
            $weekslef = 26;
            $newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
            mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
          }
          elseif($groupline['Class']="3 Months")
          {
            $weekslef = 13;
            $newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
            mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
          }
          elseif($groupline['Class']="1 Month")
          {
            $weekslef = 4;
            $newref=createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
            mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
          }
          else
          {
            if($groupline['GroupName']>10)
            {
              mysql_query("DELETE FROM GroupTableS7 WHERE GroupName='$deframentedgroup[1]'");}}
            }
          }
        }
      } //errors were here
    }
  }
}  //through here

function createReferenceValue($groupy,$weeky,$duedaty)
{
  $md=explode("-",$duedaty);
  $selector = randomgroupselection();
  $a="GR0".$groupy;
  $b="wk".$weeky;
  $c=$md[0]."D".$md[2];
  if($selector==1)
  {
    $refenciator=$a.$b.$c."A";
  }
  elseif($selector==2)
  {
    $refenciator=$b.$a."B".$c;
  }
  else
  {
    $refenciator=$c.$a."C".$b;
  }
return $refenciator;
}

//This function create random values
//to select group reference
function randomgroupselection()
{
  $nu=rand(1,3);
  return $nu;
}

mysql_close();
header("location:http://cavuanzakikolo.x10hosting.com/management.php");
?>
 

lemurina

New Member
Messages
25
Reaction score
0
Points
0
Yes.. There's ; or } missing.. But it's very hard to read that code.. :/
But I spent some time fixing your code.. and here it is.. now it should work :)

PHP:
<?php
// this program does:
// - insert the 7 sorted numbers into DB on table result
// - check for match between the 7 numbers and the playtable in DB
// - create a txtfile of the entire DB
// - update playtable
// - update grouptable

$winners = "";
$sortedspvalues = $_POST["getSuperValue"];
$gedate = $_POST["sortedate"];

$planingdate = explode("-",$gedate);

$plainfiledateS="dbcopy".$planingdate[0].$planingdate[1].$planingdate[2]."S7.txt";

$singlesortedvaluesSuper = explode("-",$sortedspvalues);
sort($singlesortedvaluesSuper);

// Connect to server and select databse.
mysql_connect("localhost", "anilson1", "anicardoso001")or die("cannot connect");
mysql_select_db("anilson1_olgDB")or die("cannot select DB");

insideproccessingsp($singlesortedvaluesSuper,$sortedspvalues,$plainfiledateS);


function insideproccessingsp($a,$b,$c){
	
$sqr121="SELECT * FROM PlayTableS7";
$result121=mysql_query($sqr121);
$counter1=mysql_num_rows($result121);

if($counter1>0){
	
//get values from database and puts into an array

while ($line = mysql_fetch_array($result121,MYSQL_BOTH)){
	
//array that gets numbers from each row of the database
$arraygetValueFromDB[0] = $line["Num1"];//represents number 1
$arraygetValueFromDB[1] = $line["Num2"];//represents number 2
$arraygetValueFromDB[2] = $line["Num3"];//represents number 3
$arraygetValueFromDB[3] = $line["Num4"];//represents number 4
$arraygetValueFromDB[4] = $line["Num5"];//represents number 5
$arraygetValueFromDB[5] = $line["Num6"];//represents number 6
$arraygetValueFromDB[6] = $line["Num7"];//represents number 7

$groupcode=$line["GroupName"];
$refcode=$line["RefNum"];
if(!in_array("$groupcode",$grouparray)){

$grouparray[]=$groupcode;
$groupLengtharray[$groupcode]=1;

}else{
	
$groupLengtharray[$groupcode]++;

}

$comparison11 = array_diff($a,$arraygetValueFromDB);

if($comparison11==Array()){ 
	
$winners= $winners.$line['GroupName']."-Slip ".$line['SlipNum']."-Draw ".$line['DrawNum'].","; 

}

$printFileName1 = $c;
$printFileHandle1 = fopen($printFileName1, "a") or die("Can not (re)open txtfile");

fwrite($printFileHandle1,$line['PersonalID']."||".$line['GroupName']."||Slip ".$line['SlipNum']."||Draw ".$line['DrawNum']."||".$line['Num1']."||".$line['Num2']."||".$line['Num3']."||".$line['Num4']."||".$line['Num5']."||".$line['Num6']."||".$line['Num7']."||".$sortedspvalues."\n");
fclose($printFileHandle1);

if(!($line["WeeksLeft"]==0)){
mysql_query("DELETE FROM PlayTableS7 WHERE GroupName='$groupcode' AND RefNum='$refcode'");
}else{
$oneweekless = $line['WeeksLeft'] - 1;
myql_query("UPDATE PlayTableS7 SET WeeksLeft='$oneweekless' WHERE GroupName='$groupcode' AND RefNum='$refcode'");
}

}
}
updategroupsp($grouparray,$groupLengtharray);
mysql_query("UPDATE ResultTable SET RecordFile='$c', SixNumWinners='$winners', SortedBalls='$b' WHERE SortedBalls='' AND GameType='S 7'");
unset($arraygetValueFromDB);
}

function updategroupsp($group,$elementsInGroup){
	
foreach($group as $valueg){
	
$deframentedgroup=explode(" ",$valueg);
$Resqr=mysql_query("SELECT * FROM GroupTableS7 WHERE GroupName='$deframentedgroup[1]'");
$groupCounting = mysql_num_rows($Resqr);

if($groupCounting>0){
	
while($groupline=mysql_fetch_array($groupCounting, MSQL_BOTH)){

if($groupline['Status']=="Complete"){
	if($groupline['Class']="6 Months"){
		if($elementsInGroup[$valueg]<100){
			mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");
		}
	}elseif($groupline['Class']="3 Months"){
		if($elementsInGroup[$valueg]<100){
			mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");
		}
	}elseif($groupline['Class']="1 Month"){
		if($elementsInGroup[$valueg]<100){
			mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$deframentedgroup[1]'");
		}
	}else{
		$weekslef = 1;
	$newref = createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
	mysql_query("UPDATE GroupTableS7 SET Status='Open',Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
	}
}else{
	if($groupline['Class']="6 Months"){
		$weekslef = 26;
		$newref = createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
		mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
	}elseif($groupline['Class']="3 Months"){
		$weekslef = 13;
		$newref = createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
		mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
	}elseif($groupline['Class']="1 Month"){
		$weekslef = 4;
		$newref = createReferenceValue($deframentedgroup[1],$weekslef,$gedate);
		mysql_query("UPDATE GroupTableS7 SET Reference='$newref' WHERE GroupName='$newref' $deframentedgroup[1]'");
	}else{
		if($groupline['GroupName']>10){
			mysql_query("DELETE FROM GroupTableS7 WHERE GroupName='$deframentedgroup[1]'");
		}
	}
}
}
}
}
}


function createReferenceValue($groupy,$weeky,$duedaty){
	
$md = explode("-",$duedaty);
$selector = randomgroupselection();
$a="GR0".$groupy;
$b="wk".$weeky;
$c=$md[0]."D".$md[2];

if($selector==1){
$refenciator=$a.$b.$c."A";
}elseif($selector==2){
$refenciator=$b.$a."B".$c;
}else{
$refenciator=$c.$a."C".$b;
}

return $refenciator;
}

//This function create random values
//to select group reference
function randomgroupselection()
{
$nu=rand(1,3);
return $nu;
}

mysql_close();
header("location:http://cavuanzakikolo.x10hosting.com/management.php");
?>
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
Yes.. There's ; or } missing.. But it's very hard to read that code.. :/
But I spent some time fixing your code.. and here it is.. now it should work :)
i'm sorry, but your code is harder to read than the code i posted. a general rule of thumb that i stick to is that any bracket that i open {} gets a new set of indents. sure, i didn't make it completely clean by adding new lines and all, but its much easier to read than the op's

i could be wrong, but the only way you'll get an unexpected end is with brackets not closed. i don't believe semicolons can cause this error to occur (unless it's on the last line before the ?>, but i'm not sure on this).
 

lemurina

New Member
Messages
25
Reaction score
0
Points
0
Dude.. I have been programming with PHP for 4 years.. I believe I know pretty much about PHP and how errors occur so trust me :)
 

anilson1

New Member
Messages
45
Reaction score
0
Points
0
Thank you,
Yes there was a missing - } -.
I think now I have a much clearer script.


-----------------------------------------


PHP:
<?php
//  this program does:
//  - insert the  7 sorted numbers into DB on table result
//  - check for match between the 7 numbers and the playtable in DB
//  - create a txtfile of the entire DB
//  - update playtable
//  - update grouptable

$winners="";
 
$sortedsupervalues = $_POST["getSuperValue"];
$sortedlottovalues = $_POST["getLottoValue"];
$gedate            = $_POST["sortedate"];

$planingdate = explode("-",$gedate);
 
$singlesortedvaluesSuper=explode("-",$sortedsupervalues);
sort($singlesortedvaluesSuper);

// Connect to server and select databse.
mysql_connect("localhost", "anilson1", "anicardoso001")or die("cannot connect"); 
mysql_select_db("anilson1_olgDB")or die("cannot select DB");
 

insideproccessingsuper($singlesortedvaluesSuper,$sortedsupervalues,$planingdate);
 

//this function updates the playtable
function insideproccessingsuper($a,$b,$c)
{
$plainfiledateS="dbcopy".$c[1].$c[2]."S7@".$c[0];
 $arraykey=0;
 $grouparray[$arraykey]="";

 $sqr121="SELECT * FROM PlayTableS7";
 $result121=mysql_query($sqr121);

 $counter1=mysql_num_rows($result121);
 if($counter1>0)
  {
//get values from database and puts into an array   
while ($line = mysql_fetch_array($result121,MYSQL_BOTH)) 
   {
//array that gets numbers from each row of the database
    $arraygetValueFromDB[0]=$line["Num1"];//represents number 1
    $arraygetValueFromDB[1]=$line["Num2"];//represents number 2
    $arraygetValueFromDB[2]=$line["Num3"];//represents number 3
    $arraygetValueFromDB[3]=$line["Num4"];//represents number 4
    $arraygetValueFromDB[4]=$line["Num5"];//represents number 5
    $arraygetValueFromDB[5]=$line["Num6"];//represents number 6
    $arraygetValueFromDB[6]=$line["Num7"];//represents number 7
 
$groupcode=$line["GroupName"];
$refcode=$line["RefNum"];
 
//it counts how many times each group exist in the playgroup
if(!in_array("$groupcode",$grouparray))
{
 $grouparray[$arraykey]=$groupcode;
 $groupLengtharray[$groupcode]=1;
 $arraykey++;
}
else
{
 $groupLengtharray[$groupcode]++;
}
//it checkes if the entered values already exist in the DB (or in the while proccessed group)
$comparison11 = array_diff($a,$arraygetValueFromDB);
    if($comparison11==Array())
    { $winners= $winners.$line['GroupName']."-Slip ".$line['SlipNum']."-Draw ".$line['DrawNum'].","; }

      // it creates a text file or updates it
    $printFileName1 = $plainfiledateS;
    $printFileHandle1 = fopen($printFileName1, "a") or die("Can not (re)open txtfile");
    fwrite($printFileHandle1,$line['PersonalID']."||".$line['GroupName']."||Slip ".$line['SlipNum']."||Draw ".$line['DrawNum']."||".$line['Num1']."||".$line['Num2']."||".$line['Num3']."||".$line['Num4']."||".$line['Num5']."||".$line['Num6']."||".$line['Num7']."||".$sortedsupervalues."\n");
    fclose($printFileHandle1);
 
if(!($line["WeeksLeft"]==0))
{mysql_query("DELETE FROM PlayTableS7 WHERE GroupName='$groupcode' AND RefNum='$refcode'");
}
else
{$oneweekless = $line['WeeksLeft'] - 1;
mysql_query("UPDATE PlayTableS7 SET WeeksLeft='$oneweekless' WHERE GroupName='$groupcode' AND RefNum='$refcode'");}
 
}
 }
updategroupsuper($c,$groupLengtharray);
 mysql_query("UPDATE ResultTable SET  RecordFile='$plainfiledateS', SixNumWinners='$winners', SortedBalls='$b' WHERE SortedBalls='' AND GameType='Super 7'");
 unset($arraygetValueFromDB);
}
 
 
 
//this function upadtes the grouptable
function updategroupsuper($defradate,$elementsInGroupS)
{
$resqrl=mysql_query("SELECT * FROM GroupTableS7");
 
$groupCountingS = mysql_num_rows($resqrl);
if($groupCountingS>0)
{while($grline=mysql_fetch_array($resqrl,MYSQL_BOTH))
{
$sdeframentedgroup = $grline['GroupName'];
 
//Delete all extra groups with no elem 
 if(($grline['GroupName']>10) && !($elementsInGroupS["Group ".$grline['GroupName']]>0))
{mysql_query("DELETE FROM GroupTableS7 WHERE GroupName='$sdeframentedgroup'");}
 
//update the table from completed to open status groups with less than 100 elem.
if($grline['Status']=="Complete")
{ if($elementsInGroupS["Group ".$grline['GroupName']]<100)
  {mysql_query("UPDATE GroupTableS7 SET Status='Open' WHERE GroupName='$sdeframentedgroup'");}}
 
 
if($grline['Class']=="6 Months")
{$sweekslef ="26";}
elseif($grline['Class']=="3 Months")
{$sweekslef="13";}
elseif($grline['Class']=="1 Month")
{$sweekslef="4";}
else
{$sweekslef="0";}

//gives to this variable a spacific  reference value for the while proccessed group
$newSref=createReferenceValue($sdeframentedgroup,$sweekslef,$defradate);
 
mysql_query("UPDATE GroupTableS7 SET Reference='$newSref'  WHERE GroupName='$sdeframentedgroup'");
 
}
}
}
 
 
 
//This creates reference values for each group
//it uses 3 different format
function createReferenceValue($groupy,$weeky,$daty)
{
$selector = randomgroupselection();
$a="GR0".$groupy;
$b="wk".$weeky;
$c=$daty[0]."D".$daty[2];
if($selector==1)
{$refenciator=$a.$b.$c."A";}
elseif($selector==2)
{$refenciator=$b.$a."B".$c;}
else
{$refenciator=$c.$a."C".$b;}
return $refenciator;
}
 
//This function create random values
//to select format
function randomgroupselection()
{
$nu=rand(1,3);
return $nu;
}
mysql_close();
header("location:http://cavuanzakikolo.x10hosting.com/aadsf Manager_fdsf/managementcorp1022.php");
?>[/quote]
 
Last edited:

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
Dude.. I have been programming with PHP for 4 years.. I believe I know pretty much about PHP and how errors occur so trust me :)
i've been programming for several years as well. you post provided the same answer as mine posted a day prior to yours.

good to hear that your problem was fixed :)
 

vol7ron

New Member
Messages
434
Reaction score
0
Points
0
This is a little off topic, but xPlozion is right. Indenting the hiearchy of logical order is a good practice to adhere to.

I also try and keep variable declarations at the top, as well as align the equal signs.

Glad to see the problem is solved.
 
Top