Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a problem with my new code the error is Parse error: syntax error, unexpected $end in C:\Program Files (x86)\Ampps\www\New\app\view\haraji.phtml on line 230 this code is about the getting some data from data base and put it in static table !

where there is not any value it will show " Not value"! in others shows the value!

here is my code:

enter code here
<?php
include('app/config.php');
$con = mysql_connect($AppConfig['db']['host'],$AppConfig['db']['user'],$AppConfig['db']['password']) or die (mysql_error());
mysql_select_db($AppConfig['db']['database'],$con);
$Tak = $this->player->playerId;
$res = mysql_query("SELECT * FROM p_haraji" );
$i=0;
$id = array();
$id['0']=0;
$id['1']=0;
$id['2']=0;
$id['3']=0;
while ($row = mysql_fetch_array($res)){
$id['$i']= $i + 1;
$i++;
}
while (!$row = mysql_fetch_array($res)){
if($i<4){
$id['$i']= 0;
$i++;
}
}
$rsltmsg = mysql_query("SELECT * FROM p_players WHERE id='$Tak'" );
$row1 = mysql_fetch_assoc($rsltmsg);
$nameix=$row1['name'];
$restmsg1=mysql_query("SELECT * FROM p_players WHERE player_type=2" );
$row2 = mysql_fetch_assoc($restmsg1);
$nameadmin=$row2['name'];
$idadmin=$row2['id'];
$subject1="جنس خریداری شد.";

If(isset ($_GET['k'])){
 If($_GET['k'] == "1"){
 If($this->data['silver'] >= $price){
 $newsilver = $this->data['silver'] - $price;

    if( $type == '1'){
            mysql_query("UPDATE p_players set popkat=popkat + 1 where id='{$Tak}'");
    }

    else if( $type == '2'){
            mysql_query("UPDATE p_players set hemkat=hemkat + 1 where id='{$Tak}'");
    }

    else if( $type == '3'){
            mysql_query("UPDATE p_players set satl=satl + 1 where id='{$Tak}'");
    }
    mysql_query("UPDATE p_players set silver='$newsilver' where id='{$Tak}'");
    $sendsms="جنس خریداری شد!";
    mysql_query("UPDATE p_players SET new_mail_count=new_mail_count+1 where id='$Tak' ") or die(mysql_error());
    mysql_query("INSERT INTO `p_msgs` (`from_player_id`, `to_player_id`, `from_player_name`, `to_player_name`, `msg_title`, `msg_body`, `creation_date`, `is_readed`, `delete_status`) VALUES( '$idadmin', '$Tak', '$nameadmin', '$nameix', '$subject', '$sendsms', now(), 0, 0)");


     }Else{$errorgold = "1";}
    If($_GET['k'] == "2"){
   If($this->data['silver'] >= $price){
   $newsilver = $this->data['silver'] - $price;

    if( $type == '1'){
            mysql_query("UPDATE p_players set popkat=popkat + 1 where id='{$Tak}'");
    }

    else if( $type == '2'){
            mysql_query("UPDATE p_players set hemkat=hemkat + 1 where id='{$Tak}'");
    }

    else if( $type == '3'){
            mysql_query("UPDATE p_players set satl=satl + 1 where id='{$Tak}'");
    }
    mysql_query("UPDATE p_players set silver='$newsilver' where id='{$Tak}'");
    $sendsms="جنس خریداری شد!";
    mysql_query("UPDATE p_players SET new_mail_count=new_mail_count+1 where id='$Tak' ") or die(mysql_error());
    mysql_query("INSERT INTO `p_msgs` (`from_player_id`, `to_player_id`, `from_player_name`, `to_player_name`, `msg_title`, `msg_body`, `creation_date`, `is_readed`, `delete_status`) VALUES( '$idadmin', '$Tak', '$nameadmin', '$nameix', '$subject', '$sendsms', now(), 0, 0)");


  }Else{$errorgold = "1";}
    If($_GET['k'] == "3"){
    If($this->data['silver'] >= $price){
     $newsilver = $this->data['silver'] - $price;

    if( $type == '1'){
            mysql_query("UPDATE p_players set popkat=popkat + 1 where id='{$Tak}'");
    }

    else if( $type == '2'){
            mysql_query("UPDATE p_players set hemkat=hemkat + 1 where id='{$Tak}'");
    }

    else if( $type == '3'){
            mysql_query("UPDATE p_players set satl=satl + 1 where id='{$Tak}'");
    }
    mysql_query("UPDATE p_players set silver='$newsilver' where id='{$Tak}'");
    $sendsms="جنس خریداری شد!";
    mysql_query("UPDATE p_players SET new_mail_count=new_mail_count+1 where id='$Tak' ") or die(mysql_error());
    mysql_query("INSERT INTO `p_msgs` (`from_player_id`, `to_player_id`, `from_player_name`, `to_player_name`, `msg_title`, `msg_body`, `creation_date`, `is_readed`, `delete_status`) VALUES( '$idadmin', '$Tak', '$nameadmin', '$nameix', '$subject', '$sendsms', now(), 0, 0)");


   }Else{$errorgold = "1";}
   If($_GET['k'] == "4"){
   If($this->data['silver'] >= $price){
    $newsilver = $this->data['silver'] - $price;

    if( $type == '1'){
            mysql_query("UPDATE p_players set popkat=popkat + 1 where id='{$Tak}'");
    }

    else if( $type == '2'){
            mysql_query("UPDATE p_players set hemkat=hemkat + 1 where id='{$Tak}'");
    }

    else if( $type == '3'){
            mysql_query("UPDATE p_players set satl=satl + 1 where id='{$Tak}'");
    }
    mysql_query("UPDATE p_players set silver='$newsilver' where id='{$Tak}'");
    $sendsms="جنس خریداری شد!";
    mysql_query("UPDATE p_players SET new_mail_count=new_mail_count+1 where id='$Tak' ") or die(mysql_error());
    mysql_query("INSERT INTO `p_msgs` (`from_player_id`, `to_player_id`, `from_player_name`, `to_player_name`, `msg_title`, `msg_body`, `creation_date`, `is_readed`, `delete_status`) VALUES( '$idadmin', '$Tak', '$nameadmin', '$nameix', '$subject', '$sendsms', now(), 0, 0)");


 }Else{$errorgold = "1";}
 };

   If(isset($errorgold) AND $errorgold == "1"){echo "<h3>لطفا شما کم است</h3>";}
   echo 'شما <img src="assets/x.gif" class="gold" alt="طلا"  title="طلا">'.$this->data['gold_num']." مقدار طلا داريد  <BR / >";
 ?>
 <table class="rate_details lang_rtl lang_ar" cellpadding="1" cellspacing="1">
 <thead>
 <tr>
 <th colspan="5"><center>حراجی</center></th>
 </tr>
<tr>
    <td>
        شماره
    </td>
    <td>
        صاحب
    </td>
    <td>
        قیمت
    </td>
    <td>
        نوع جنس
    </td>
    <td>
        خريد
    </td>
</tr>
  </thead>
  <tbody>
  <!-- <jens1> -->
<tr>
    <td>
    <?php echo $id['0'];    ?>
    </td>
    <td>
    <?php if( $id['0'] != '0'){ $res1 = mysql_query("SELECT * FROM p_haraji where id='{$id['0']}'" ); $row1 = mysql_fetch_array($res1); $id_saheb=$row1['owner']; $res11 = mysql_query("SELECT * FROM p_players where id='{$id_saheb}'" ); $row11 = mysql_fetch_array($res11);  $name=$row11['name']; echo $name;} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
    <?php if( $id['0'] != '0'){ $res1 = mysql_query("SELECT * FROM p_haraji where id='{$id['0']}'" ); $row1 = mysql_fetch_array($res1); $price=$row1['price']; echo $price;} else { echo "جنسی موجود نسیت";}?>
    </td>
    <td>
    <?php if( $id['0'] != '0'){ $res1 = mysql_query("SELECT * FROM p_haraji where id='{$id['0']}'" ); $row1 = mysql_fetch_array($res1); $type=$row1['type']; if($type == '1'){ echo "کتیبه جمعیت";} else if($type == '2'){ echo "کتیبه حمایت";} else if ( $type == '3'){ echo "سطل";}} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
        <?php if($id['0'] != '0'){ echo "<a href=\"haraji.php?k=1\">خرید</a>";} else { echo "غیر فعال";}?>
    </td>
</tr>
   <!-- </jens1> -->
  <!-- <jens2> -->
<tr>
    <td>
    <?php echo $id['1'];    ?>
    </td>
    <td>
    <?php if( $id['1'] != '0'){ $res2 = mysql_query("SELECT * FROM p_haraji where id='{$id['1']}'" ); $row2 = mysql_fetch_array($res2); $id_saheb=$row2['owner']; $res22 = mysql_query("SELECT * FROM p_players where id='{$id_saheb}'" ); $row22 = mysql_fetch_array($res22);  $name=$row22['name']; echo $name;} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
    <?php if( $id['1'] != '0'){ $res2 = mysql_query("SELECT * FROM p_haraji where id='{$id['1']}'" ); $row2 = mysql_fetch_array($res2); $price=$row2['price']; echo $price;} else { echo "جنسی موجود نسیت";}?>
    </td>
    <td>
    <?php if( $id['1'] != '0'){ $res2 = mysql_query("SELECT * FROM p_haraji where id='{$id['1']}'" ); $row2 = mysql_fetch_array($res2); $type=$row2['type']; if($type == '1'){ echo "کتیبه جمعیت";} else if($type == '2'){ echo "کتیبه حمایت";} else if ( $type == '3'){ echo "سطل";}} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
        <?php if($id['1'] != '0'){ echo "<a href=\"haraji.php?k=2\">خرید</a>";} else { echo "غیر فعال";}?>
    </td>
</tr>
    <!-- </jens2> -->
    <!-- <jens3> -->
<tr>
    <td>
    <?php echo $id['2'];    ?>
    </td>
    <td>
    <?php if( $id['2'] != '0'){ $res3 = mysql_query("SELECT * FROM p_haraji where id='{$id['2']}'" ); $row3 = mysql_fetch_array($res3); $id_saheb=$row3['owner']; $res33 = mysql_query("SELECT * FROM p_players where id='{$id_saheb}'" ); $row33 = mysql_fetch_array($res33);  $name=$row33['name']; echo $name;} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
    <?php if( $id['2'] != '0'){ $res3 = mysql_query("SELECT * FROM p_haraji where id='{$id['2']}'" ); $row3 = mysql_fetch_array($res3); $price=$row3['price']; echo $price;} else { echo "جنسی موجود نسیت";}?>
    </td>
    <td>
    <?php if( $id['2'] != '0'){ $res3 = mysql_query("SELECT * FROM p_haraji where id='{$id['2']}'" ); $row3 = mysql_fetch_array($res3); $type=$row3['type']; if($type == '1'){ echo "کتیبه جمعیت";} else if($type == '2'){ echo "کتیبه حمایت";} else if ( $type == '3'){ echo "سطل";}} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
    <?php if($id['2'] != '0'){ echo "<a href=\"haraji.php?k=3\">خرید</a>";} else { echo "غیر فعال";}?>
    </td>
</tr>
    <!-- </jens3> -->
    <!-- <jens4> -->
<tr>
    <td>
    <?php echo $id['3'];    ?>
    </td>
    <td>
    <?php if( $id['3'] != '0'){ $res4 = mysql_query("SELECT * FROM p_haraji where id='{$id['3']}'" ); $row4 = mysql_fetch_array($res4); $id_saheb=$row4['owner']; $res44 = mysql_query("SELECT * FROM p_players where id='{$id_saheb}'" ); $row44 = mysql_fetch_array($res44);  $name=$row44['name']; echo $name;} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
    <?php if( $id['3'] != '0'){ $res4 = mysql_query("SELECT * FROM p_haraji where id='{$id['3']}'" ); $row4 = mysql_fetch_array($res4); $price=$row4['price']; echo $price;} else { echo "جنسی موجود نسیت";}?>
    </td>
    <td>
    <?php if( $id['3'] != '0'){ $res4 = mysql_query("SELECT * FROM p_haraji where id='{$id['3']}'" ); $row4 = mysql_fetch_array($res4); $type=$row4['type']; if($type == '1'){ echo "کتیبه جمعیت";} else if($type == '2'){ echo "کتیبه حمایت";} else if ( $type == '3'){ echo "سطل";}} else { echo "جنسی موجود نیست";}?>
    </td>
    <td>
    <?php if($id['3'] != '0'){ echo "<a href=\"haraji.php?k=4\">خرید</a>";} else { echo "غیر فعال";}?>
    </td>
</tr>
   <!-- </jens3> -->
   </tbody>
   </table>
  <?php 
  mysql_close($con);
   ?>

enter code here
share|improve this question
2  
When you fix your indentation you'll see very quickly what the problem is. –  Lightness Races in Orbit Dec 23 '12 at 19:09
add comment

closed as too localized by Jocelyn, CSᵠ, Tim Bish, Lance Roberts, Danack May 9 '13 at 15:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 1 down vote accepted

You have missed a closing bracket }

review your script making sure all your brackets {...} match up correctly.

Narrowed it down:

Lines:

If(isset ($_GET['k'])){
 If($_GET['k'] == "1"){

Do not have matching closing brackets, for either of those two lines. and only you know where these if statements finish.

Update:

Line 77:

If($_GET['k'] == "3"){

I'm pretty sure there is more.. But you get the jist. I would suggest you start to indent your code per bracket. Formatting and debugging will be easier.

share|improve this answer
    
Thank you very much! It's working now –  user1925409 Dec 23 '12 at 19:59
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.