Title: Parse Error?
Last modified: August 18, 2016

---

# Parse Error?

 *  Anonymous
 * [21 years, 6 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/)
 * I’ve just installed WP, and it’s working, hitting the DB OK and everything, but
   I keep getting these perplexing parse errors on various pages. Here’s one example:
   
   on wp-admin/options-general.php when i submit the form, I get: Parse error: parse
   error, unexpected $ in /home/bullrush/public_html/wordpress/wp-admin/optionhandler.
   php on line 108 nothing looks amiss on line 108 or anywhere near it, to my not-
   very-php-capable eye. I’ve tried re-downloading WP, deleting the offending files,
   and reuploading them. No dice. any ideas? thanks! GD

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/parse-error-1-2-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/parse-error-1-2-2/page/2/?output_format=md)

 *  Thread Starter Anonymous
 * [21 years, 6 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111046)
 * I’m having the same problem— could it be due to the fact that I’m using a MAC
   os 9?
 *  Thread Starter Anonymous
 * [21 years, 6 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111101)
 * I don’t see how the client OS would affect things — the parse error happens when
   the server can’t make sense of the PHP code.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 6 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111102)
 * It looks like you have an unexpected $ in optionhandler.php on line 108. What
   it is actually referring to is the output, so navigate your browser over to optionhandler.
   php and save the source. On line 108, you’ll find an unexpected $. Now, look 
   in the actual optionhandler.php and try to find the line that looks similar to
   line 108 in the source. There you will find your unexpected $. You could also
   delete the old optionhandler.php from your server and upload a fresh on from 
   the WP download.
 *  [durf](https://wordpress.org/support/users/durf/)
 * (@durf)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111154)
 * I’m getting the exact same parse error. Line 108, optionhandler.php . . . But
   I can’t view as source, since the only source visible when I go to that page 
   in the browser is the error message.
 * Line 108 looks like this in my install (which is brand new and not altered a 
   bit–I was trying to make some changes in the settings when it started doing this):
 * $range = $wpdb->get_row(“SELECT optionvalue_max, optionvalue_min FROM $tableoptionvalues
   WHERE option_id = $option->option_id”);
 * The optionhandler.php on my local HD (where I unzipped the install files) looks
   exactly the same. Do I need to delete a character here?
 *  [durf](https://wordpress.org/support/users/durf/)
 * (@durf)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111155)
 * No ideas? If this is what the files do “out of the box” I can’t really use WordPress.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111157)
 * Do you have any plugins installed? Have you made any code modifications?
 *  [durf](https://wordpress.org/support/users/durf/)
 * (@durf)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111158)
 * Thanks for your reply!
 * I’ve made no changes whatsoever. This was a fresh, clean install, and I was going
   in there for the first time to make some changes to the settings (the title of
   the weblog and so forth). Hitting the “Update Options” button gets me that parse
   error. I’d try uploading that .php file again, but the unpacked one on my local
   disk is the same as the one that’s up there now.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111159)
 * Hm, it sounds like you got a bad file upload or something of that sort. Since
   you just started out, would you be ok with deleting all of the files and the 
   MySQL database, then download a fresh copy of WordPress and start over?
 * Do not overwrite the files. overwriting files via FTP can lead to incomplete 
   transfers.
 * Follow these installations instructions carefully: [http://codex.wordpress.org/Installing_WordPress](http://codex.wordpress.org/Installing_WordPress)
 *  [durf](https://wordpress.org/support/users/durf/)
 * (@durf)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111160)
 * Yeah, I might have to go that route . . . Hey, it’s only my free time, right?
   🙂
 * Here’s hoping it works better the second time.
 *  [hidden_premise](https://wordpress.org/support/users/hidden_premise/)
 * (@hidden_premise)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111161)
 * From my experience of php its usually within 5 lines of your error tho so try
   reading the context of the situation. Look for absolutely any syntax errors not
   just random $’s. Look for unclosed clauses (no }’s) or quotation issues. Another
   thing that could be causing this is something in your database, some sort of 
   input you put in is not getting escaped and is therefore creating a parse error.
   Something like a slash or quotes… Try checking through all your input via myphpadmin
   and escaping all your punctuation…
 *  [durf](https://wordpress.org/support/users/durf/)
 * (@durf)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111162)
 * The problem is that I know nothing of PHP syntax . . . I could post the whole
   section of code here, I guess:
 * function validate_option($option, $name, $val) {
    global $wpdb, $tableoptionvalues;
   $msg = ”; switch ($option->option_type) { case 6: // range // get range $range
   = $wpdb->get_row(“SELECT optionvalue_max, optionvalue_min FROM $tableoptionvalues
   WHERE option_id = $option->option_id”); if ($range) { if (($val < $range->optionvalue_min)
   || ($val > $range->optionvalue_max)) { $msg = “$name is outside the valid range(
   $range->optionvalue_min – $range->optionvalue_max). “; } } } // end switch return
   $msg; } // end validate_option
 *  [hidden_premise](https://wordpress.org/support/users/hidden_premise/)
 * (@hidden_premise)
 * [21 years, 4 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111163)
 * From what i know about php i see no errors in syntax, except possibly the line“
   case 6: // range” I am not sure what the hell the whole case 6 thing is… try 
   commenting it out and uploading. Other than that syntax is perfect. I’m really
   starting to think some unescaped value from your database that is being run through
   here is what is causing your trouble.. Make sure all of your punctuation marks
   are escaped.
 *  [durf](https://wordpress.org/support/users/durf/)
 * (@durf)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111176)
 * Oog . . . I ended up zapping everything, setting up a new database and user, 
   reinstalling 1.5 completely fresh, and now I’ve run into this one:
 * Parse error: parse error, unexpected $ in /home/durf/public_html/news/wp-includes/
   wp-db.php on line 347
 * Line 347 of this file (and all the surrounding lines) is right in the middle 
   of the HTML code. No $ in sight.
 *  [ajit](https://wordpress.org/support/users/ajit/)
 * (@ajit)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111182)
 * <?php
 * $flag=true;
    $link=mysql_connect(“localhost”, “ajit”, “ajit”) or die (“Could 
   not connect to MySQL”);
 *  mysql_select_db (“ajit”)
    or die (“Could not select database”); $submitSearch
   =$_POST[‘submit’]; $name=$_POST[‘search’]; $add=$_POST[‘add’]; if(isset($link)){
   if(isset($submitSearch)) { if(isset($name)) {
 *  $searchResult=mysql_query(‘select * from personInfo where name LIKE `"$name"
   ORDER BY date DESC;')
    or die ("Query failed"); if(mysql_num_rows($searchResult)
   >0 ){ display_table($searchResult); } else{ echo"no such row obtained"; } } else{
   echo"Give the name of person you want to search";}
 *  }
    elseif(isset($add)) {
 *  Header("Location: [http://192.168.0.10/~ajit/infoform.php&quot](http://192.168.0.10/~ajit/infoform.php&quot););
   }
 *  else{
    $result = mysql_query('select * from personInfo order BY date DESC;')
   or die ("Query failed"); $num=mysql_num_rows($result);
 *  display_table($result);
    }
 *  }
 *  else{
    echo"could not connect to the database";
 *  }
 * /* THIS TABLE WILL DISPLAY ALL FETCHED ROWS FROM TABLE + ADD EDIT LINK+
    +E-MAIL
   LINK*/
 *  function display_table($result)
    { if(isset($result)) { $subject="REMINDER ABOUT
   WORK"; $messege="Hello sir/madam"; print "<table border=1><br>"; $temp=0; echo"
   <tr>"; for($temp=0;$temp<18;$temp++) { echo"<td>"; $fieldname= mysql_field_name(
   $result, $temp); echo"$fieldname"; echo"</td>"; } echo"</tr>";
 *  while ($line = mysql_fetch_array($result))
    { echo "<tr>";
 *  foreach ($line as $key=>$value)
    { $temp=0; if ((mysql_field_name($result, $
   temp)=="emailid")) { echo "<td>"; [@mail](https://wordpress.org/support/users/mail/)(
   $value, $subject, $message );
 *  //echo'<a href="mailto:$value?subject="Feedback">E-MAIL</a>';
    echo "</td>";}
 *  else{
    echo "<td>"; echo"$value"; echo"</td>"; }
 *  $row = mysql_fetch_array($result,MYSQL_NUM);
    $id=$row[0]; //echo”<td align=\”
   center\” bgcolor=\”#5647A1\” onclick=\”window.location.href=’editform.php’;\”
   > EDIT </td>”;
 * 
 *  $temp++;
    echo “</tr>”; } print “</table><br>”; } } else{ echo”NO RESULTS FOUND”;
 * }
    }
 * ?>
 * <html>
    <head> <title>PERSON INFORMATION</title> </head> <body>
 * <form method=”post” >
    <input type=”text” name=”search” <br> <label> SEARCH PERSON
   NAME</label> <input type=”submit” name=”submit” value=”SEARCH”> <input type=”
   submit” name=”add” value=”ADD_NEW_RECORD”> </form> </body> </html>
 *  [ajit](https://wordpress.org/support/users/ajit/)
 * (@ajit)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/parse-error-1-2-2/#post-111183)
 * hi
    can anybody will help me?
 * gettin error parse error, unexpected $ on last line

Viewing 15 replies - 1 through 15 (of 16 total)

1 [2](https://wordpress.org/support/topic/parse-error-1-2-2/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/parse-error-1-2-2/page/2/?output_format=md)

The topic ‘Parse Error?’ is closed to new replies.

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 16 replies
 * 5 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [21 years, 1 month ago](https://wordpress.org/support/topic/parse-error-1-2-2/page/2/#post-111184)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
