lansing
06-14-2006, 11:23 PM
I have the code below & keep getting this error:
Parse error: parse error, unexpected T_ELSE in
/home/httpd/vhosts/domain.com/httpdocs/members/edit_account.php on line 85
I have looked at the code & don't see anything wrong. I have made sure that all my if {} else {} statements are closed & they are. Basically this page is a update page for user info. It displays the form that is refilled with their current info. Then when they click the Save button it queries customer_table the db for all their current info & inserts that into history_table, then it updates customer_table with their new info.
Then queries do have more data in them, but I deleted them before posting this code here.<?php
if(isset($_POST['save']))
{
$id = $_SESSION['id'];
$history_details = mysql_query("SELECT * FROM $customer_table WHERE customers= '$id'");
while ($line = mysql_fetch_array($history_details)) {
$customers = stripslashes($line["customers"]);
echo'';
$sql = mysql_query("INSERT INTO $history_table (customers)
VALUES($customers)")
or die (mysql_error());
if(!$sql)
{
die('There has been an error updating your account. Please contact the webmaster.');
}
else
{
$id = $_SESSION['id'];
$customers_street = addslashes($_POST['customers_street']);
$update_customer = ("UPDATE $customer_table SET customers_street = '$customers_street'
WHERE customers = '$id'");
$update_query = mysql_query($update_customer) or die(mysql_error());
if(!$update_query)
{
echo 'Error in updating customer contact information!';
echo 'Try again or contact support';
}
else
{
echo 'Customer contact information successfully updated!';
}
}
}
else
{
$id = $_SESSION['id'];
$customer_details = mysql_query("SELECT * FROM $customer_table WHERE customers_id= '$id' ");
while ($line = mysql_fetch_array($customer_details)) {
$customers = stripslashes($line["customers"]);
echo'';
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" name="customer_details" id="customer_details">
<table width="100%" border="0" align="center" class="newsheader">
<caption>
Customer Details for <strong><? echo "$_SESSION['username']" ?></strong>
</caption>
<tr>
<td width="17%"><div align="right">First Name:</div></td>
<td width="26%" class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td width="23%"><div align="right">E-Mail:</div></td>
<td width="34%" class="regulartextbold"><div align="left"><?=$ ?></div></td>
</tr>
<tr>
<td><div align="right">Last Name: </div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td><div align="right">Phone:</div></td>
<td><div align="left">
<input name="customers_phone" type="text" id="customers_phone" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Street:</div></td>
<td>
<div align="left">
<input name="customers_street_address" type="text" id="customers_street_address" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Mobile:</div></td>
<td><div align="left">
<input name="customers_phone2" type="text" id="customers_phone2" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">City:</div></td>
<td>
<div align="left">
<input name="customers_city" type="text" id="customers_city" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Fax:</div></td>
<td><div align="left">
<input name="customers_fax" type="text" id="customers_fax" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">State:</div></td>
<td>
<div align="left">
<input name="customers_state" type="text" id="customers_state" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct #:</div></td>
<td><div align="left">
<input name="egold_number" type="text" id="egold_number" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Zip:</div></td>
<td>
<div align="left">
<input name="customers_postcode" type="text" id="customers_postcode" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct Name:</div></td>
<td><div align="left">
<input name="egold_name" type="text" id="egold_name" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Country:</div></td>
<td>
<div align="left">
<input name="customers_country" type="text" id="customers_country" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct #:</div></td>
<td><div align="left">
<input name="ebullion_number" type="text" id="ebullion_number" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Phone:</div></td>
<td>
<div align="left">
<input name="customers_phone" type="text" id="customers_phone" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct Name:</div></td>
<td><div align="left">
<input name="ebullion_name" type="text" id="ebullion_name" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">IP:</div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td><div align="right">Last Login: </div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
</tr>
<tr>
<td><div align="right">Registered:</div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td><div align="right">Modified:</div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
</tr>
<tr>
<td colspan="4"><div align="center">
<input name="save" type="submit" id="save" value="Save">
</div></td>
</tr>
</table>
</form>
<?
}
?>
Parse error: parse error, unexpected T_ELSE in
/home/httpd/vhosts/domain.com/httpdocs/members/edit_account.php on line 85
I have looked at the code & don't see anything wrong. I have made sure that all my if {} else {} statements are closed & they are. Basically this page is a update page for user info. It displays the form that is refilled with their current info. Then when they click the Save button it queries customer_table the db for all their current info & inserts that into history_table, then it updates customer_table with their new info.
Then queries do have more data in them, but I deleted them before posting this code here.<?php
if(isset($_POST['save']))
{
$id = $_SESSION['id'];
$history_details = mysql_query("SELECT * FROM $customer_table WHERE customers= '$id'");
while ($line = mysql_fetch_array($history_details)) {
$customers = stripslashes($line["customers"]);
echo'';
$sql = mysql_query("INSERT INTO $history_table (customers)
VALUES($customers)")
or die (mysql_error());
if(!$sql)
{
die('There has been an error updating your account. Please contact the webmaster.');
}
else
{
$id = $_SESSION['id'];
$customers_street = addslashes($_POST['customers_street']);
$update_customer = ("UPDATE $customer_table SET customers_street = '$customers_street'
WHERE customers = '$id'");
$update_query = mysql_query($update_customer) or die(mysql_error());
if(!$update_query)
{
echo 'Error in updating customer contact information!';
echo 'Try again or contact support';
}
else
{
echo 'Customer contact information successfully updated!';
}
}
}
else
{
$id = $_SESSION['id'];
$customer_details = mysql_query("SELECT * FROM $customer_table WHERE customers_id= '$id' ");
while ($line = mysql_fetch_array($customer_details)) {
$customers = stripslashes($line["customers"]);
echo'';
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" name="customer_details" id="customer_details">
<table width="100%" border="0" align="center" class="newsheader">
<caption>
Customer Details for <strong><? echo "$_SESSION['username']" ?></strong>
</caption>
<tr>
<td width="17%"><div align="right">First Name:</div></td>
<td width="26%" class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td width="23%"><div align="right">E-Mail:</div></td>
<td width="34%" class="regulartextbold"><div align="left"><?=$ ?></div></td>
</tr>
<tr>
<td><div align="right">Last Name: </div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td><div align="right">Phone:</div></td>
<td><div align="left">
<input name="customers_phone" type="text" id="customers_phone" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Street:</div></td>
<td>
<div align="left">
<input name="customers_street_address" type="text" id="customers_street_address" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Mobile:</div></td>
<td><div align="left">
<input name="customers_phone2" type="text" id="customers_phone2" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">City:</div></td>
<td>
<div align="left">
<input name="customers_city" type="text" id="customers_city" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Fax:</div></td>
<td><div align="left">
<input name="customers_fax" type="text" id="customers_fax" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">State:</div></td>
<td>
<div align="left">
<input name="customers_state" type="text" id="customers_state" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct #:</div></td>
<td><div align="left">
<input name="egold_number" type="text" id="egold_number" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Zip:</div></td>
<td>
<div align="left">
<input name="customers_postcode" type="text" id="customers_postcode" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct Name:</div></td>
<td><div align="left">
<input name="egold_name" type="text" id="egold_name" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Country:</div></td>
<td>
<div align="left">
<input name="customers_country" type="text" id="customers_country" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct #:</div></td>
<td><div align="left">
<input name="ebullion_number" type="text" id="ebullion_number" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">Phone:</div></td>
<td>
<div align="left">
<input name="customers_phone" type="text" id="customers_phone" value="<?=$ ?>" class="regulartextbold">
</div></td>
<td><div align="right">Acct Name:</div></td>
<td><div align="left">
<input name="ebullion_name" type="text" id="ebullion_name" value="<?=$ ?>" class="regulartextbold">
</div></td>
</tr>
<tr>
<td><div align="right">IP:</div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td><div align="right">Last Login: </div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
</tr>
<tr>
<td><div align="right">Registered:</div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
<td><div align="right">Modified:</div></td>
<td class="regulartextbold"><div align="left"><?=$ ?></div></td>
</tr>
<tr>
<td colspan="4"><div align="center">
<input name="save" type="submit" id="save" value="Save">
</div></td>
</tr>
</table>
</form>
<?
}
?>