Title: Error on line 4?
Last modified: December 28, 2016

---

# Error on line 4?

 *  [nothawaii](https://wordpress.org/support/users/nothawaii/)
 * (@nothawaii)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/error-on-line-4/)
 * Hi,
 * I downloaded the plugin, pasted my code in, and there is an error: Parse error:
   syntax error, unexpected ‘if’ (T_IF) in /home/content/a2pnexwpnas01_data01/13/
   3468913/html/wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code
   on line 4.
 * Here is my code:
    [insert_php] $db = new mysqli(‘ip’, ‘user’, ‘password’, ‘database’);
   if($db->connect_errno > 0){     die(‘Unable to connect to database [‘ . $db->
   connect_error . ‘]’); } $sql = “SELECT * FROM `banlist` ORDER BY banTime DESC”;
   if(!$result = $db->query($sql)){     die(‘There was an error running the query[‘.
   $db->error . ‘]’); }   function convertToHumanReadableTime($seconds) {     $ret
   = “”;     if (empty($seconds))     {         return “Permanent”;     }     /***
   get the days ***/     $days = intval(intval($seconds) / (3600*24));     if($days
   > 0)     {         $ret .= “$days days “;     }       /*** get the hours ***/
   $hours = (intval($seconds) / 3600) % 24;     if($hours > 0)     {         $ret.
   = “$hours hours “;     }       /*** get the minutes ***/     $minutes = (intval(
   $seconds) / 60) % 60;     if($minutes > 0)     {         $ret .= “$minutes minutes“;}/***
   get the seconds ***/     $seconds = intval($seconds) % 60;     if ($seconds >
   0) {         $ret .= “$seconds seconds”;     }       return $ret; }   echo ‘<
   table class=”table table-striped”>  <tr>    <th>Character Name</th>     <th>Ban
   Reason</th>    <th>Ban Length</th>     <th>Banned On</th>  </tr>’;   while($row
   = $result->fetch_assoc()){     echo ‘<tr>    <td>[‘.$row[‘charactername’].’](http://steamcommunity.com/profiles/&apos;.$row[&apos;steamId&apos;].&apos;)
   </td>     <td>’.$row[‘banMessage’].'</td>    <td>’.convertToHumanReadableTime(
   $row[‘banDuration’]).'</td>     <td>’.date(“m/d/Y”, strtotime($row[‘banTime’])).'
   </td>  </tr>’; } echo ‘</table>’; [/insert_php]

Viewing 1 replies (of 1 total)

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/error-on-line-4/#post-8600061)
 * Hi,
 * There is an error at line 4 of the PHP code between the [insert_php] and [/insert_php]
   tags.
 * Here is more information about error messages:
 * [http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#errormessages](http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#errormessages)
 * Will

Viewing 1 replies (of 1 total)

The topic ‘Error on line 4?’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/error-on-line-4/#post-8600061)
 * Status: not resolved