Jump to content

Recommended Posts

Maybe someone could figure this one out. I have been testing my site locally, then uploaded it to my godaddy hosting account and a couple of my pages are getting error 500's with a parse error unexpected $end.

Here is one of the pages with this.

<?php include("header.php"); ?>

<?php
require_once('config.php');
//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag = false;

//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
	die('Failed to connect to server: ' . mysql_error());
}
	//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
	die("Unable to select database");
}

if(isset($_POST['submit']))

  {
  				$subject = mysql_escape_string($_POST['subject']);
			$catagory = mysql_escape_string($_POST['catagory']);
  			$notes = mysql_escape_string($_POST['notes']);
      			$status = "Open";
			$agent = $_SESSION['SESS_MEMBER_ID'];
			$priority = mysql_escape_string($_POST['Priority']);
			$duedate=mysql_escape_string($_POST['duedate']);

			$query = "INSERT into tasks SET Subject='$subject', Status='$status', Catagory='$catagory', Notes='$notes', Agent='$agent', Priority='$priority', DueDate='$duedate'";
			$result = mysql_query($query);



echo mysql_error();  
          echo "<b>Thank you! Task Added Successfully!<br>You'll be redirected to Task Page after (3) Seconds";
	  echo "<meta http-equiv=Refresh content=3;url=tasks.php>";
	  }
	  else
	  {
	  echo "<BR>";
	  echo "<font color=\"#000066\">All Tasks</font>";
	  $agent1 = $_SESSION['SESS_MEMBER_ID'];
	  $query = "SELECT * FROM tasks WHERE Agent=$agent1 ORDER by Status DESC";
	$result=mysql_query($query);

                while($myrow = mysql_fetch_assoc($result)) 
             {//begin of loop 
		 $taskID=$myrow['ID'];
		 $subject=$myrow['Subject'];
		 $status=$myrow['Status'];
		 $notes=$myrow['Notes'];
		 $priority=$myrow['Priority'];
		 $catagory=$myrow['Catagory'];
		 $duedate=$myrow['DueDate'];
		 $agent=$myrow['Agent'];
?>
<table border="0">
<tr><th>Subject: </th><td><?php echo $subject;?><td><th>Status<td><?php echo $status;?><td><th>Priority<td><?php echo $priority;?><td><th>Catagory<td><?php echo $catagory;?><td><th>Due Date<td><?php echo $duedate;?><td><a href=taskclose.php?ID=$taskID>Close Task</a><td><a href=outlook.php?ID=$taskID>Export to Outlook Calendar</a></td></td></td></th></td></td></th></td></td></th></td></td></th></td></td></tr>
</table>
<?
}
}
?>

<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
  <table border="0" cellspacing="0" cellpadding="2" align="left">
    <tr><td><p>::NEW TASK</p></td><td>
    <tr><td>Subject: 
    <tr><td><input name="subject" size="40" maxlength="255" value=""/>
      <td><p align=left>Catagory: </p><td> 
   		<select name="catagory">
		<option value="Business">Business</option>
		<option value="Personal">Personal</option>
	</select></td></td></tr>
        <BR />
        <tr><td> <p align=left>Notes: </p><td> 
<tr><td><textarea name="notes" cols="30" rows="3"></textarea></td></td>
    <tr><td><p>Priority:</p></td>
    <tr><td><select name="Priority">
     <option value="High">High</option>
     <option value="Medium">Medium</option>
     <option value="Low">Low</option>
     </select>
     <tr><td>Due Date: 
     <tr><td><input name="duedate"  size="10" maxlength="10" value="" onFocus="javascript:vDateType='1'" onKeyUp="DateFormat(this,this.value,event,false,'1')" onBlur="DateFormat(this,this.value,event,true,'1')"/>
    <tr><td><input name="submit" type="submit" value="Add Task" /></td>
    </form>
    
</body>
</html>

I know this error usually comes from messing up closing brackets, braces, ect but I cant see why this exact file works on my local apache/php5/mysql setup and not the godaddy php5 setup. Maybe something I'm missing in the php.ini settings?

Link to comment
https://forums.phpfreaks.com/topic/139584-solved-php-error/
Share on other sites

 

 

2) 64 Never use short tags

 

It is likely that the unexpected $end error is caused by that because the php code after the <? tag is not seen as being code and that code is two }} which would generate that error.

 

Be consistent in your coding and don't use short open tags.

Link to comment
https://forums.phpfreaks.com/topic/139584-solved-php-error/#findComment-730252
Share on other sites

It is likely that the unexpected $end error is caused by that because the php code after the tag is not seen as being code and that code is two }} which would generate that error.

 

That would explain,

 

then uploaded it to my godaddy hosting account

 

because your server's version of PHP probably doesn't have short tags turned on.

Link to comment
https://forums.phpfreaks.com/topic/139584-solved-php-error/#findComment-730267
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.