Page 1 of 1

lost the tag value

Posted: Sat Aug 14, 2010 9:36 am
by mehdi4467
hi
in a php file I assign a value to a tag. and with it make a condition for mysql command. but when run query and then using a form for sending some values to a function, all thin is work , but the vale of tag erased.
when i trying to define this tag as global I see below errors.

Code: Select all

Parse error:  parse error, unexpected '=', expecting ',' or ';' in C:\Apache2\htdocs\bill\desktop\send_game.php on line 64

Re: lost the tag value

Posted: Sat Aug 14, 2010 9:50 am
by shawngoldw
you have a syntax error. Only way anyone can help you is if you post line 64 of send_game.php. The line before may also be helpful.

Shawn

Re: lost the tag value

Posted: Sat Aug 14, 2010 9:51 am
by mehdi4467

Code: Select all

<?php
if(isset($_POST['add']))
{
   send_game();
}
?>
         <form action='' method='post'>
            <input name='filter' type='submit' id='filter' value='تائيد' />
            <select dir="ltr" name="week">
               <option value="1">هفته اول</option>
               <option value="2">هفته دوم</option>
               <option value="3">هفته سوم</option>
               <option value="4">هفته چهارم</option>
               <option value="5">هفته پنجم</option>
            </select>            
            فيلتر هفته
         </form>
         <?php $week = get_param($_POST, "week");
                <?php
            $result  = $db->sql_query("SELECT * FROM `billing_game` WHERE `game_week`='$week'" );
            while($show_result=$db->sql_fetcharray($result))
            {
               $result2 = $db->sql_query("SELECT * FROM `billing_results` WHERE (`results_gameid`='{$show_result['game_id']}')  AND (`results_userid`='{$_SESSION['SUB_USER_ID']}')");
               $show_result2=mysql_num_rows($result2);
               if($show_result2 != 0 )
               {
                  $result1 = $db->sql_query("SELECT * FROM `billing_results` WHERE (`results_gameid`='{$show_result['game_id']}') AND (`results_userid`='{$_SESSION['SUB_USER_ID']}')");
                  $show_result1=$db->sql_fetcharray($result1);
                  $re_ft = $show_result1['results_firstteam'];
                  $re_st = $show_result1['results_secondteam'];
                  $status ="$re_st-$re_ft";
               }
               else   
               {
                  $g=$show_result['game_id'];
                  $status = "
                  <form action='' method='post'>
                  <input name='add' type='submit' id='add' value='&#1579;&#1576;&#1578;' />
                  <input name='second_results' type='text' class='results_user_input_text ' id='second_results' />
                  <input name='first_results' type='text' class='results_user_input_text ' id='first_resultse' />
                  <input type='hidden' name='game_id' value='$g' />
                  </form>
                  ";   
               }
            }
            echo $msg


function send_game()
{
   global $db;
   $first_results  = get_param($_POST, "first_results");
   $second_results = get_param($_POST, "second_results");
   $game_id        = get_param($_POST, "game_id");
   
   if($first_results == "")
   {
      $GLOBALS['msg'] = "<font color=red>&#1606;&#1578;&#1610;&#1580;&#1607; &#1605;&#1610;&#1586;&#1576;&#1575;&#1606; &#1608;&#1575;&#1585;&#1583; &#1606;&#1588;&#1583;&#1607; &#1575;&#1587;&#1578;</font>";
   }
   elseif($second_results == "")
   {
      $GLOBALS['msg'] = "<font color=red>&#1606;&#1578;&#1610;&#1580;&#1607; &#1605;&#1610;&#1607;&#1605;&#1575;&#1606; &#1608;&#1575;&#1585;&#1583; &#1606;&#1588;&#1583;&#1607; &#1575;&#1587;&#1578;.</font>";
   }
   else
   {
      if($db->sql_query("INSERT INTO `billing_results` VALUES (null,'$game_id', '{$_SESSION['SUB_USER_ID']}', '$first_results', '$second_results', '1')"))
      {
         $GLOBALS['msg'] = "<font color=green>&#1575;&#1591;&#1604;&#1575;&#1593;&#1575;&#1578; &#1576;&#1575; &#1605;&#1608;&#1601;&#1602;&#1740;&#1578; &#1575;&#1585;&#1587;&#1575;&#1604; &#1588;&#1583;</font>";
      }
      else
      {
         $GLOBALS['msg'] = "<font color=red>&#1575;&#1591;&#1604;&#1575;&#1593;&#1575;&#1578; &#1575;&#1585;&#1587;&#1575;&#1604; &#1606;&#1588;&#1583;</font>";
      }
   }
}
?>
the value of $week lost.
and I delete some html code from my code for better understanding.
and error happen when i add global to this line:

Code: Select all

 <?php $week = get_param($_POST, "week");
like this

Code: Select all

 <?php global $week = get_param($_POST, "week");

Re: lost the tag value

Posted: Sat Aug 14, 2010 10:09 am
by shawngoldw
try

Code: Select all

 <?php 
global $week;
$week = get_param($_POST, "week");

Re: lost the tag value

Posted: Sat Aug 14, 2010 10:15 am
by mehdi4467
thanks, work. but this way did not solve my main problem.
my main problem is:
in a php file I assign a value to a tag. and with it make a condition for mysql command. but when run query and then using a form for sending some values to a function, all thin is work , but the vale of tag erased.

Re: lost the tag value

Posted: Sat Aug 14, 2010 12:28 pm
by shawngoldw
Delete the second php tag here:
<?php $week = get_param($_POST, "week");
<?php

Maybe that will help.