Page 1 of 1

PHP error please help

Posted: Thu May 25, 2006 10:15 am
by reecec
Hi everyone

i have this code but it gives this error and i cant see where its coming from please could someone help

rse error: parse error, unexpected $ in /home/reeceth/public_html/game/buyfone.php on line 28

i cant see a $ i dont know if i have missed something of left something open

this is my code

Code: Select all

<?php

include('config.php');

// Connect to server and select database.
mysql_connect("localhost","reeceth_12","dell12")or die("cannot connect server ");
mysql_select_db("reeceth_12")or die("cannot select DB");

$phones=$_POST['phones'];

$sql="SELECT * FROM gameinfo WHERE username ='reece";
$result1=mysql_query($sql1);

$rows=mysql_fetch_array($result1);
$money=$rows['money'];


//$cost = 'cost of article purchased';
//$availableCash = 'amount of money the user has';

if($phones > $money) {
    echo "Not Enough Money";} 
else {
   $moneyLeft = $money - $phones;
   $query = "UPDATE gameinfo SET money=$moneyLeft WHERE username='reece';
$result=mysql_query($query);
} 
?>
Thanks a lot


reece

Posted: Thu May 25, 2006 10:17 am
by JayBird
Pretty easy to spot with syntax highlighting

look at this line

Code: Select all

$query = "UPDATE gameinfo SET money=$moneyLeft WHERE username='reece';

hi

Posted: Thu May 25, 2006 10:38 am
by reecec
Thanks i see it