Jump to content

[SOLVED] Parse error: syntax error, unexpected '{' on line 204


justinjkiss

Recommended Posts

i just cant figure out my problem. Even had a friend that is fairly good at php programing look at it and he didnt know either. I have a feeling that it is in the table creation area that is causing my problem.

 

...
<?
/**
* The user is already logged in and not allowed to register unless admin.
*/
if($session->isAdmin()){
 echo "[<a href=\"../dealercenter.php\">Dealer Center Home</a>]   ";
 echo "[<a href=\"process.php\">Logout</a>]";
  ?>

<br /><br /><p>Add Warranty Table</p>
<form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Username:</td><td><input type="text" name="user" maxlength="30"></td>
</tr>
<tr>
				<td><input type="submit" value="Add Warranty table!"></td>
			</tr>
</table>
</form>

<?
$user=$_POST['user'];
$sql = "CREATE TABLE `custkis6_login`.`$user` ( `model` varchar( 10 ) NOT NULL ,
`serial` int( 10 ) NOT NULL ,
`servdate` varchar( 10 ) NOT NULL ,
`faildate` varchar( 10 ) NOT NULL ,
`repairdate` varchar( 10 ) NOT NULL ,
`comment` longtext NOT NULL ,
`traveltime` mediumint( 3 ) NOT NULL ,
`repairtime` mediumint( 3 ) NOT NULL ,
`claimhours` mediumint( 3 ) NOT NULL ,
`hourrate` varchar( 3 ) NOT NULL ,
`claimname` varchar( 50 ) NOT NULL ,
PRIMARY KEY ( `serial` ) ) ENGINE = MyISAM DEFAULT CHARSET = latin1;[...]";

   }
   else ($session->logged_in){
   	echo "<p>Access Denied</p>";
echo "<p>We're sorry <b>$session->username</b>, but you've not allowed to view this page. "
   		 ."<a href=\"../dealercenter.php\">Main</a>.</p>";


}
...

Thanks!!!

 

That was the problem. I swear i copied the code from something that used that if else statement but i guess i must have modified it by mistake because i went and looked at what i copied it from and sure enough i was missing the else "if".

where do i click that?

 

Also i dont think my database submission is working properly. It wont add and i feel the user variable isnt registering the way it is wrote. Is this the area for that? Should i make a new topic? Im new here if you cant tell.

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.