Jump to content

parse error?


Nicholas16

Recommended Posts

hi, im getting this error

 

"Parse error: syntax error, unexpected '<' in /home/a3122898/public_html/index.php on line 207"

 

this is my coding for index.php, can anyone find out the problem for me at all? i dont get it....

<?php
$housequery=1;
include "globals.php";
print "<h3>General Information:</h2>";
<table><tr><td><b>Name:</b> {$ir['username']}</td><td><b>Knifes:</b> {$cm}</td></tr><tr>
<td><b>Level:</b> {$ir['level']}</td>
<td><b>Money:</b> $fm</td>
<td><b>Hit Points:</b> {$ir['hp']}/{$ir['maxhp']}</td></tr>
<tr><td><b>Property:</b> {$ir['hNAME']}</td></tr></table>";
print "<hr><h3>Stats Info:</h3>";
$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);

print "<table><tr><td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td><td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr>
<tr><td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td><td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr>
<tr><td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td><td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td></tr></table>";
if(isset($_POST['pn_update']))
{
$db->query("UPDATE users SET user_notepad='{$_POST['pn_update']}' WHERE userid=$userid");
$ir['user_notepad']=stripslashes($_POST['pn_update']);
print "<hr><b>Personal Notepad Updated!</b>";
}
print "<hr>Your Personal Notepad:<form action='index.php' method='post'>
<textarea rows='10' cols='50' name='pn_update'>".htmlspecialchars($ir['user_notepad'])."</textarea><br />
<input type='submit' value='Update Notes' /></form>";
$h->endpage();
?>

 

EDIT: Please use [code][/code] tags.

Link to comment
Share on other sites

nope i cant figure it out, i dont know what it means by "on line 207" what does it mean?

It means the error is on, or close to, line 207 of your code.

 

The error can be resolved by reviewing line 4 of the code that you have posted, though.

Link to comment
Share on other sites

nope i cant figure it out, i dont know what it means by "on line 207" what does it mean?

It means the error is on, or close to, line 207 of your code.

 

The error can be resolved by reviewing line 4 of the code that you have posted, though.

 

so 4 lines down, is line 207? does "on line 207" mean 207 letters down then?

Link to comment
Share on other sites

No, it means 207 lines down. If that is actually the contents of your whole file I guess it is taking the lines inside your included globals.php file into consideration too.

 

The error you are experiencing is being caused by this:

print "<h3>General Information:</h2>";

Change it to this:

print "<h3>General Information:</h3>

 

I have removed the double quote and semi-colon that terminate the line. I have also fixed an error in your HTML.

Link to comment
Share on other sites

sorry about this, the line 207 is fixed now. thanks SemiApocalptic. but erm now i get another error in index.php lol... just my luck really... there is probably more errors on index.php, ill probably ask for more help on this post if there is any more errors :-\ anyways this is what it say:

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/a3122898/public_html/index.php on line 215

 

<?php
$housequery=1;
include "globals.php";
print "<h2>General Information:</h2>
<table><tr>
<td><b>Name:</b> {$ir['username']}</td>
<td><b>Knifes:</b> {$cm}</td></tr><tr>
<td><b>Level:</b> {$ir['level']}</td>
<td><b>Money:</b> $fm</td>
<td><b>Hit Points:</b> {$ir['hp']}/{$ir['maxhp']}</td></tr><tr>
<td><b>Property:</b> {$ir['hNAME']}</td></tr></table>";
print "<h2>Stats Information:</h2>
$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);

print "<table><tr>
<td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td>
<td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr><tr>
<td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td>
<td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr><tr>
<td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td>
<td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td></tr></table>";
$h->endpage();
?>

Link to comment
Share on other sites

thanks Bendude14, im just wondering... i keep on getting errors for this stupid index.php lol, now its line 304... can someone just recode it all and post it on here please? it would help out alot. and hopefully wouldnt need to post on here about what line the error is on in index.php.

it would be greatful if someone can spend a little bit of time and recode it so its all right? and wont have any errors.

Link to comment
Share on other sites

thanks Bendude14, im just wondering... i keep on getting errors for this stupid index.php lol, now its line 304... can someone just recode it all and post it on here please? it would help out alot. and hopefully wouldnt need to post on here about what line the error is on in index.php.

it would be greatful if someone can spend a little bit of time and recode it so its all right? and wont have any errors.

 

sorry this is the coding ive got lol

 

<?php
$housequery=1;
include "globals.php";
print "<h2>General Information:</h2>
<table><tr>
<td><b>Name:</b> {$ir['username']}</td>
<td><b>Knifes:</b> {$cm}</td></tr><tr>
<td><b>Level:</b> {$ir['level']}</td>
<td><b>Money:</b> $fm</td>
<td><b>Hit Points:</b> {$ir['hp']}/{$ir['maxhp']}</td></tr><tr>
<td><b>Property:</b> {$ir['hNAME']}</td></tr></table>";
print "<h2>Stats Information:</h2>";
$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);

print "<table><tr><td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td><td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr>
<tr><td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td><td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr>
<tr><td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td><td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td></tr></table>";
if(isset($_POST['pn_update']))
{
$db->query("UPDATE users SET user_notepad='{$_POST['pn_update']}' WHERE userid=$userid");
$ir['user_notepad']=stripslashes($_POST['pn_update']);
print "<hr><b>Personal Notepad Updated!</b>";
}
print "<hr>Your Personal Notepad:<form action='index.php' method='post'>
<textarea rows='10' cols='100' name='pn_update'>".htmlspecialchars($ir['user_notepad'])."</textarea><br />
<input type='submit' value='Update Notes' /></form>";
$h->endpage();
?>

Link to comment
Share on other sites

This should work now, you need to be more carefull when writing code it really isnt a hard problem to resolve :)

 

<?php
$housequery=1;
require_once("globals.php"); // you cant just require it 

print "<h2>General Information:</h2>
<table><tr>
<td><b>Name:</b> {$ir['username']}</td>
<td><b>Knifes:</b> {$cm}</td></tr><tr>
<td><b>Level:</b> {$ir['level']}</td>
<td><b>Money:</b> $fm</td>
<td><b>Hit Points:</b> {$ir['hp']}/{$ir['maxhp']}</td></tr><tr>
<td><b>Property:</b> {$ir['hNAME']}</td></tr></table>";

print "<h2>Stats Information:</h2>"; // "; was missing

$ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ'];
$ir['strank']=get_rank($ir['strength'],'strength');
$ir['agirank']=get_rank($ir['agility'],'agility');
$ir['guarank']=get_rank($ir['guard'],'guard');
$ir['labrank']=get_rank($ir['labour'],'labour');
$ir['IQrank']=get_rank($ir['IQ'],'IQ');
$tsrank=get_rank($ts,'strength+agility+guard+labour+IQ');
$ir['strength']=number_format($ir['strength']);
$ir['agility']=number_format($ir['agility']);
$ir['guard']=number_format($ir['guard']);
$ir['labour']=number_format($ir['labour']);
$ir['IQ']=number_format($ir['IQ']);
$ts=number_format($ts);

print "<table><tr>
<td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td>
<td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr><tr>
<td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td>
<td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr><tr>
<td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td>
<td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td></tr></table>"; // "; was missing 
$h->endpage();
?>

Link to comment
Share on other sites

Nicholas16, I think you would benefit from learning the basics of the language before jumping into things.

 

Two forward slashes denote the start of a comment, and does not get processed by the PHP interpreter. You can leave notes throughout your code using this concept.

Link to comment
Share on other sites

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.