Jump to content

Recommended Posts

Hey guys, I'm kind of new to PHP so it's probablly something simple, My error is this

 

Parse error: syntax error, unexpected '{', expecting '(' in /home/xxxxxxxx/public_html/files/x/return.php on line 36

 

on line 36 there is this,

 

$A = $m['A'];
$e = $m['e']; // LINE 36 HERE
if ($F >= $AV)
{
$F2 = $F - $e;
mysql_query("UPDATE Users
SET F=$F2
WHERE id = '$DI'") or die(mysql_error());  
$done = 1;
}
if($A >= $e and $done == 0)
{
$A2 = $A - $e;
mysql_query("UPDATE Users
SET A=$A2
WHERE id = '$DI'") or die(mysql_error());  
}

 

So I'm not really sure what's wrong, I've checked a few sites and I think I'm using the right syntax?

Thanks very much guys!

Link to comment
https://forums.phpfreaks.com/topic/266300-if-command-not-working/
Share on other sites

<?php
session_start();
include ("../config.php");
mysql_query("UPDATE statistics
SET views=views+1
WHERE id = 1")
or die (mysql_error());
include ("../config2.php");
$ADI = $_SESSION['ADI'];
$y = mysql_query("SELECT SiteURL FROM Users
WHERE UID='$DI'") or die(mysql_error());  
$z = mysql_fetch_array( $y );
$SITE = $z['SiteURL'];
$SITE2 = 'http://' . $SITE . '';
$IP = $_SERVER['REMOTE_ADDR']; 
$namef = "counter.txt";
$handlef = fopen($namef, 'r') or die ("zero");
$counter = fread($handlef, filesize($namef));
fclose ($handlef);
$counter = $counter + 1;
$namef2 = "counter.txt";
$handlef2 = fopen($namef2, 'w') or die ("zero");
fwrite($handlef2, $counter);
fclose ($handlef2);
$final = $counter . ")" . $IP . "<br />";
$name = "iplist.html";
$handle = fopen($name, 'a') or die ("0");
fwrite ($handle, $final);
fclose ($handle);
$DI = $_SESSION['DI'];
$p = mysql_query("SELECT * FROM Users
WHERE id = '$DI'") or die(mysql_error());  
$m = mysql_fetch_array( $p );
$F = $m['F'];
$A = $m['A'];
$e = $m['e']; // LINE 36 HERE
if ($F >= $AV)
{
$F2 = $F - $e;
mysql_query("UPDATE Users
SET F=$F2
WHERE id = '$DI'") or die(mysql_error());  
$done = 1;
}
if($A >= $e and $done == 0)
{
$A2 = $A - $e;
mysql_query("UPDATE Users
SET A=$A2
WHERE id = '$DI'") or die(mysql_error());  
}
header("location: $SITE2");
?>

 

There you go:)

I'm prittey sure there is no syntax errors however

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.