28, May 2012

php error when parsing file - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: php error when parsing file
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: php error when parsing file  (Read 1230 times)
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 886
1148 credits
Members referred : 4



« on: Aug 24, 2006, 08:42:23 pm »

error:

Quote
Parse error: parse error, unexpected $ in /hsphere/local/home/meth0d42/3rd-evolution.net/administration/ranks_colors.php on line 67

code:

Code:
<?php
require_once "../maincore.php";
require_once 
BASEDIR."subheader.php";
require_once 
ADMIN."navigation.php";

if (!
checkrights("RC") || !defined("iAUTH") || $aid != iAUTHfallback("../index.php");
opentable('Add New Rank');
echo 
"<center>Sorry, this function is currently unavailable.</center>";
closetable();

tablebreak();

opentable('Manage Ranks');

if(
$_GET[clanranks]) 

if ($_POST['submit'] != 'Update')

$data mysql_query("SELECT * from fusion_clanranks where rank_id = '$_GET[clanranks]'"); 
$data mysql_fetch_array($data); 
echo(
<div align='center'><form method='post'>
<table>
<tr>
<td valign='top'>Rank ID #: </td>
<td valign='top'><input name='rank_id' type='text' value='
$data[rank_id]'></td>
</tr>
<tr>
<td valign='top'>Rank Name: </td>
<td valign='top'><input name='rank_name' type='text' value='
$data[rank_name]'></td>
</tr>
<tr>
<td valign='top'>Rank Color: </td>
<td valign='top'><input name='rank_color' type='text' value='
$data[rank_color]'>
</td>
</tr>
<tr>
<td align='center' colspan=2><input type='submit' name='submit' value='Update'></td>
</tr>
</table>
</form> 
</div>"
); 
} else {
$rank_id $_POST['rank_id']; 
$rank_name $_POST['rank_name']; 
$rank_color $_POST['rank_color'];
$update = ("UPDATE fusion_clanranks set rank_id = '$rank_id', rank_name = '$ramk_name', rank_color = '$rank_color' where rank_id = '{$_GET[clanranks]}'"); 
mysql_query($update) or die(mysql_error());
echo "The rank has been successfully updated."
}
} else {
$getclanranks mysql_query("SELECT * from fusion_clanranks order by rank_id asc"); 
while($data mysql_fetch_array($getclanranks)) 

    $result mysql_query("select * from fusion_clanranks order by rank_id"); 
     while($r=mysql_fetch_array($result)) 
   
   $rank_id=$r['rank_id'];
    
}
echo("<a href='?clanranks=$data[rank_id]'>$data[rank_name]</a><br />"); 
}

closetable();


require_once 
BASEDIR."footer.php";
?>


Last blog : phpHaze 1.59.1 in Development
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Aug 24, 2006, 09:17:30 pm »

you forgot the last curly bracket:

Code:
<?php
require_once "../maincore.php";
require_once 
BASEDIR."subheader.php";
require_once 
ADMIN."navigation.php";

if (!
checkrights("RC") || !defined("iAUTH") || $aid != iAUTHfallback("../index.php");
opentable('Add New Rank');
echo 
"<center>Sorry, this function is currently unavailable.</center>";
closetable();

tablebreak();

opentable('Manage Ranks');

if(
$_GET[clanranks]) { 
if ($_POST['submit'] != 'Update') { 
$data mysql_query("SELECT * from fusion_clanranks where rank_id = '$_GET[clanranks]'"); 
$data mysql_fetch_array($data); 
echo(
<div align='center'><form method='post'>
<table>
<tr>
<td valign='top'>Rank ID #: </td>
<td valign='top'><input name='rank_id' type='text' value='
$data[rank_id]'></td>
</tr>
<tr>
<td valign='top'>Rank Name: </td>
<td valign='top'><input name='rank_name' type='text' value='
$data[rank_name]'></td>
</tr>
<tr>
<td valign='top'>Rank Color: </td>
<td valign='top'><input name='rank_color' type='text' value='
$data[rank_color]'>
</td>
</tr>
<tr>
<td align='center' colspan=2><input type='submit' name='submit' value='Update'></td>
</tr>
</table>
</form> 
</div>"
); 
} else {
$rank_id $_POST['rank_id']; 
$rank_name $_POST['rank_name']; 
$rank_color $_POST['rank_color'];
$update = ("UPDATE fusion_clanranks set rank_id = '$rank_id', rank_name = '$ramk_name', rank_color = '$rank_color' where rank_id = '{$_GET[clanranks]}'"); 
mysql_query($update) or die(mysql_error());
echo "The rank has been successfully updated."
}
} else {
$getclanranks mysql_query("SELECT * from fusion_clanranks order by rank_id asc"); 
while($data mysql_fetch_array($getclanranks)) { 
    
$result mysql_query("select * from fusion_clanranks order by rank_id"); 
     
while($r=mysql_fetch_array($result)) { 
   
$rank_id=$r['rank_id'];
     
}
echo("<a href='?clanranks=$data[rank_id]'>$data[rank_name]</a><br />"); 
}
}
closetable();


require_once 
BASEDIR."footer.php";
?>


as you can see I formatted the code to make it better readable, do the same and you will see your misatkes much better.

aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 886
1148 credits
Members referred : 4



« Reply #2 on: Aug 24, 2006, 09:27:14 pm »

i dont get the parsing error anymore, but when i click a link to the rank, to edit it, it reloads my sites front page (backtracks outside of the admin panel)

edit: typo- from=front
« Last Edit: Aug 24, 2006, 09:45:20 pm by Meth0d »


Last blog : phpHaze 1.59.1 in Development
aka J Love
Community Supporter ?
Bill Gates is my home boy
*****
Gender: Male
Posts: 886
1148 credits
Members referred : 4



« Reply #3 on: Aug 25, 2006, 06:31:07 am »

well i spent all day trying to work this out on my own, going back and reading tutorials, snippets on php.net, and advice from Wineo, Nikolas, and the latest ones from you Olaf. i have completed what this page was intended for, it turned out to be 3 pages in the end, here are the working results:

this is a rank system add on for php fusion. you can add, manage/edit, and delete existing ranks from this management centre. they also come with colors, and this color can be changed via the same area, this color applies to all areas of the site where you see a users username.

website: see 3rd-evolution.net (not real link to prevent any value i might gain from it being here), but add www. and check it out for yourselves (the colored ranks).

page: ranks_colors.php (main page)
Code:
<?php
require_once "../maincore.php";
require_once 
BASEDIR."subheader.php";
require_once 
ADMIN."navigation.php";

if (!
checkrights("RC") || !defined("iAUTH") || $aid != iAUTHfallback("../index.php");
//////////////////////////////////////////////
opentable('Manage Ranks & Colors');
echo 
"<center>[<a href='add_rank.php".$aidlink."'>Add New Rank</a>]<br><br></center>";


if(
$_GET['clanranks']) { 

if (
$_POST['submit'] != 'Update') { 
$data mysql_query("SELECT * from ".$db_prefix."clanranks where rank_id = '$_GET[clanranks]'"); 
$data mysql_fetch_array($data); 
echo(

<div align='center'><form method='post'>
<table>
<tr>
<td valign='top'>Rank ID # (?): </td>
<td valign='top'><input class='textbox' name='rank_id' type='text' value='"
.$data['rank_id']."'></td>
</tr>
<tr>
<td valign='top'>Rank Name (?): </td>
<td valign='top'><input class='textbox' name='rank_name' type='text' value='"
.$data['rank_name']."'></td>
</tr>
<tr>
<td valign='top'>Rank Color (?): </td>
<td valign='top'><input class='textbox' name='rank_color' type='text' value='"
.$data['rank_color']."'>
</td>
</tr>
<tr>
<td align='center' colspan='2'><input class='button' type='submit' name='submit' value='Update'></td>
</tr>
</table>
</form> 
</div>"
);
echo 
"<center><br><br>Click [<a href='".BASEDIR."administration/ranks_colors.php".$aidlink."'>here</a>] to return to the Ranks/Colors Manager.</center>"
} else {
$rank_id $_POST['rank_id']; 
$rank_name $_POST['rank_name']; 
$rank_color $_POST['rank_color'];
$update = ("UPDATE ".$db_prefix."clanranks set rank_id = '$rank_id', rank_name = '$rank_name', rank_color = '$rank_color' where rank_id = '{$_GET[clanranks]}'"); 
mysql_query($update) or die(mysql_error());
echo 
"<center>The rank <b><font color='$rank_color'>$rank_name</font></b> has been successfully updated.<br><br>Click [<a href='".BASEDIR."administration/ranks_colors.php".$aidlink."'>here</a>] to return to the Ranks/Colors Manager.</center>"
}
} else {
echo 
"<center>
<table class='tbl-border' width='450'>
<tr>
<td class='tbl1' align='center'><b>Rank ID # </b></td>
<td class='tbl2' align='center'><b>Rank Name </b></td>
<td class='tbl1' align='center'><b>Options </b></td>
</tr>"
;
$getclanranks mysql_query("SELECT * from ".$db_prefix."clanranks order by rank_id asc"); 
while(
$data mysql_fetch_array($getclanranks)) 

if(!isset($cmd)) 
{
$result mysql_query("select * from ".$db_prefix."clanranks order by rank_id"); 
while($r=mysql_fetch_array($result)) 

$rank_id=$r['rank_id'];
     
}
}
echo 
"<tr><td class='tbl1' align='center'>".$data['rank_id']."</td>";
echo 
"<td class='tbl2' align='left'><font color='".$data['rank_color']."'>".$data['rank_name']."</font></td>";
echo 
"<td class='tbl1' align='center'>[<a href='".FUSION_SELF.$aidlink."&clanranks=".$data['rank_id']."'>Edit</a>] - [<a href='del_rank.php".$aidlink."&cmd=delete&rank_id=".$data['rank_id']."'>Delete</a>]<br /></td></tr>"
}echo 
"</table></center>";
}

closetable();
///////////////////////////////////////

require_once BASEDIR."footer.php";
?>


page: add_rank.php
Code:
<?php
require_once "../maincore.php";
require_once 
BASEDIR."subheader.php";
require_once 
ADMIN."navigation.php";

if (!
checkrights("RC") || !defined("iAUTH") || $aid != iAUTHfallback("../index.php");
//////////////////////////////////////////////
opentable('Add New Rank');
echo 
"<center>[<a href='ranks_colors.php".$aidlink."'>Return to Ranks/Colors Management</a>]<br><br></center>";
if(
$_POST['submit']) {
$rank_name $_POST['rank_name']; 
$rank_color $_POST['rank_color'];
$query = ("INSERT INTO ".$db_prefix."clanranks (rank_name, rank_color) VALUES ('$rank_name', '$rank_color');");
mysql_query($query) or die(mysql_error());
echo "<center>You have successfully added a new rank!<br><br>Click [<a href='".BASEDIR."administration/ranks_colors.php".$aidlink."'>here</a>] to return to the Ranks/Colors Manager.</center>"
} else {
echo "<form method='post'>
<center><table>
<tr>
<td valign='top'>Rank Name (?): </td>
<td valign='top'><input name='rank_name' type='text' class='textbox'></td>
</tr>
<tr>
<td valign='top'>Rank Color (?): <br> </td>
<td valign='top'><input name='rank_color' type='text' value='#' class='textbox'>
</td>
</tr>
<tr>
<td valign='top' colspan='2' align='center'><input type='submit' name='submit' value='Create Rank' class='button'></td>
</tr>
</table></center>
</form>"
;
}
closetable();
///////////////////////////////////////

require_once BASEDIR."footer.php";
?>


page: del_rank.php
Code:
<?php
require_once "../maincore.php";
require_once 
BASEDIR."subheader.php";
require_once 
ADMIN."navigation.php";

if (!
checkrights("RC") || !defined("iAUTH") || $aid != iAUTHfallback("../index.php");
opentable('Delete Rank');

if(
$_GET["cmd"]=="delete")
{
    $sql "DELETE FROM ".$db_prefix."clanranks WHERE rank_id=$rank_id";
    $result mysql_query($sql);
    echo "<center>Rank deleted!<br><br>Click [<a href='".BASEDIR."administration/ranks_colors.php".$aidlink."'>here</a>] to return to the Ranks/Colors Manager.</center>";
}
closetable();


require_once 
BASEDIR."footer.php";
?>

if you would like screenshots of the management centre in action let me know Smiley


Last blog : phpHaze 1.59.1 in Development
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3802
Tags : php tutorials snippets Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: php error when parsing file
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 03:24:29 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.