Jump to content

SNYTAX ERROR, help needed!!!


terror

Recommended Posts

Error:

[code]
Parse error: syntax error, unexpected '<' in /home/zack/public_html/rpg/main.php on line 49
[/code]

Code
[code]
<? include('header'); ?>
<?php
include('inc/dbconnect.php');
$sql = "SELECT * FROM stats WHERE stats.id=$_COOKIE[id]";
$res = mysql_query($sql);
$sql2 = "SELECT * FROM ability WHERE ability.id=$_COOKIE[id]";
$res2 = mysql_query($sql2);
$res3 = mysql_fetch_assoc($res);
$res4 = mysql_fetch_assoc($res2);
$level = $res3[level];
$xp = $res3[xp];
$xpadd = $res3[xpadd];
$health = $res3[health];
$outhp = $level * 100;
$attack = $res3[attack];
$defence = $res3[defence];
$fire = $res3[fire];
$water = $res3[water];
$blizzard = $res3[blizzard];
$thunder = $res3[thunder];
$mana = $res3[mana];
$manaout = $level * 20;
if($xpadd == 40){
//
}else{
include('inc/levels.php');
};
?>
Welcome <?=$res3[username]?> to your stats page!<br><br>
<table border=0 cellspacing=0 cellpadding=2>
<tr><td>
Level:<td><?=$level?>/100
<tr><td>
Experience:<td><?=$xp?>
<tr><td>
Health:<td><?=$health?>/<?=$outhp?>
<tr><td>
Attack:<td><?=$attack?>
<tr><td>
Defence:<td><?=$defence?>
<tr><td>
Mana:<td><?=$mana?>/<?=$manaout?>
<tr><td>
Magic:<td>
if $level < 4;
echo:{ "None";
}else{
if $level >= 4;
echo:<?=$fire><?=water><?=blizzard?><?=thunder?>
</table>
<? include('footer'); ?>
[/code]

Iunno whats wrong, someone help.  If you wanna help beta test with me the url is rpg.mildrum.net
Link to comment
https://forums.phpfreaks.com/topic/26238-snytax-error-help-needed/
Share on other sites

many things i see: main thing i see is <?=$thing?> should be <? echo $thing ?>
AND
[code=php:0]
Magic:<td>
//you need to open php
<?
//you need to change if statements
if($level < 4){
echo "None";
}elseif($level >= 4){
echo "$fire $water $blizzard $thunder";
?>
</table>
<? include('footer'); ?>
[/code]
nothing just a different error, with your mod to it the new error is

[code]
Parse error: syntax error, unexpected $end in /home/zack/public_html/rpg/main.php on line 52
[/code]

and if i fixed the script correctly the new code is
[code]
<? include('header'); ?>
<?php
include('inc/dbconnect.php');
$sql = "SELECT * FROM stats WHERE stats.id=$_COOKIE[id]";
$res = mysql_query($sql);
$sql2 = "SELECT * FROM ability WHERE ability.id=$_COOKIE[id]";
$res2 = mysql_query($sql2);
$res3 = mysql_fetch_assoc($res);
$res4 = mysql_fetch_assoc($res2);
$level = $res3[level];
$xp = $res3[xp];
$xpadd = $res3[xpadd];
$health = $res3[health];
$outhp = $level * 100;
$attack = $res3[attack];
$defence = $res3[defence];
$fire = $res3[fire];
$water = $res3[water];
$blizzard = $res3[blizzard];
$thunder = $res3[thunder];
$mana = $res3[mana];
$manaout = $level * 20;
if($xpadd == 40){
//
}else{
include('inc/levels.php');
};
?>
Welcome <?=$res3[username]?> to your stats page!<br><br>
<table border=0 cellspacing=0 cellpadding=2>
<tr><td>
Level:<td><?=$level?>/100
<tr><td>
Experience:<td><?=$xp?>
<tr><td>
Health:<td><?=$health?>/<?=$outhp?>
<tr><td>
Attack:<td><?=$attack?>
<tr><td>
Defence:<td><?=$defence?>
<tr><td>
Mana:<td><?=$mana?>/<?=$manaout?>
<tr><td>
Magic:<td>
<?php
if($level < 4){
echo "None";
}elseif($level >= 4){
echo "$fire $water $blizzard $thunder";
?>
</table>
<? include('footer'); ?>
[/code]
oops! thats a simple fix :)


[code=php:0]
<? include('header'); ?>
<?php
include('inc/dbconnect.php');
$sql = "SELECT * FROM stats WHERE stats.id=$_COOKIE[id]";
$res = mysql_query($sql);
$sql2 = "SELECT * FROM ability WHERE ability.id=$_COOKIE[id]";
$res2 = mysql_query($sql2);
$res3 = mysql_fetch_assoc($res);
$res4 = mysql_fetch_assoc($res2);
$level = $res3[level];
$xp = $res3[xp];
$xpadd = $res3[xpadd];
$health = $res3[health];
$outhp = $level * 100;
$attack = $res3[attack];
$defence = $res3[defence];
$fire = $res3[fire];
$water = $res3[water];
$blizzard = $res3[blizzard];
$thunder = $res3[thunder];
$mana = $res3[mana];
$manaout = $level * 20;
if($xpadd == 40){
//
}else{
include('inc/levels.php');
};
?>
Welcome <? echo $res3[username] ?> to your stats page!<br><br>
<table border=0 cellspacing=0 cellpadding=2>
<tr><td>
Level:<td><? echo $level ?>/100
<tr><td>
Experience:<td><? echo $xp ?>
<tr><td>
Health:<td><? echo $health ?>/<? echo $outhp ?>
<tr><td>
Attack:<td><? echo $attack ?>
<tr><td>
Defence:<td><? echo $defence ?>
<tr><td>
Mana:<td><? echo $mana ?>/<? echo $manaout ?>
<tr><td>
Magic:<td>
<?php
if($level < 4){
echo "None";
}elseif($level >= 4){
echo "$fire $water $blizzard $thunder";
}
?>
</table>
<? include('footer'); ?>
[/code]

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.