Jump to content

Getting error when everything looks right.


Smudly

Recommended Posts

For some reason, the following code is giving this error:

Parse error: syntax error, unexpected '}' in /home/content/s/m/u/smudlys/html/ratestest.php  on line 21

 

This is the line after the first if statement.

 

 

MySql version: 5.0.19

 

Here is my code:

<?php
/// Include Admin Page Here ///
include('inc/connect.php');

$user = $_SESSION['username'];
$getmember = mysql_query("SELECT * FROM users WHERE username='$user'");
while ($row = mysql_fetch_assoc($getmember))
{
$member = $row['member'];
}
$getlevel = mysql_query("SELECT * FROM userstats WHERE username='$user'");
while ($row = mysql_fetch_assoc($getlevel))
{
$level = $row['level'];
}

$addrate = .005;

if($member==0){
$rate = ($level*$addrate+.50)
}
if($member==1){
$rate = ($level*$addrate+1)
}

?>

Those darn semi colons. Thank you! it works

 

Except one small problem. When I try echoing out $rate, it says it is .5

 

When in reality, it should be .505

(user's level is 1, and member=0)

 

How do I make it include all the decimal places?

 

Thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.