Title: Code doesn&#8217;t run in snippit
Last modified: June 20, 2018

---

# Code doesn’t run in snippit

 *  Resolved [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * (@david_navigator)
 * [8 years ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/)
 * Hi
 * Been using the [inseret_php] tag pair for ages – tried moving my code into a 
   snippet but I get no output (nor error message).
    (Have checked that the snippet
   is Active and the code is correctly inserted in to the post).
 *     ```
       $user="php_XXXXXXX";
       $password="XXXXXXX";
       $database="mantis_XXXXXXX";
       mysql_connect("mysql.XXXXXXX.com",$user,$password);
       @mysql_select_db($database) or die( "Unable to select database");
       $query="Select 0 as id, '[CAT]' as ord, 'Version: ', version as description, Case when date_order <= UNIX_TIMESTAMP(now()) then 'released on' else 'release scheduled' end as releaseinfo , DATE_FORMAT(FROM_UNIXTIME(date_order), '%e %M %Y') as released, '' as level,'' as bugnumber, '!',date_order,'' AS NOTES, '[/CAT]' as ord_end from mantis_project_version_table V where (project_id = 8 and /* date_order <= UNIX_TIMESTAMP(now()) and */ date_order > 1270000000 AND version IN (SELECT fixed_in_version FROM mantis_bug_table WHERE severity IN (10,20,25))) UNION Select B.id, '[FEATURE]' as ord,'', case severity when 10 then '(Enhancement)' when 20 then '(Enhancement)' when 25 then '(Enhancement)' else '(Bug Fix) ' end as description , ''as releaseinfo ,'' as released, replace(summary,'%%','%%%%') as level , Concat(' [', format(B.id ,0), ']') as bugnumber, '!',date_order, T.additional_information AS NOTES, '[/FEATURE]' as ord_end from mantis_bug_table B Inner join mantis_project_version_table W on fixed_in_version = W.version INNER JOIN mantis_bug_text_table T on B.id = T.id where (view_state = 10 AND B.Project_Id=8 and /* date_order <= UNIX_TIMESTAMP(now()) AND */ W.Project_Id=8 and date_order> 1270000000) and severity in (10,20,25) order by date_order desc, ord, description desc, level;";
       //$query="Select * from mantis_project_version_table";
       $result=mysql_query($query);
       $totalrows=mysql_num_rows($result);
       //Print "Count=$totalrows\n";
   
       $j=0;
       for ($i=0; $i<$totalrows; ++$i)
       {
       $ord=mysql_result($result,$i,"ord");
       $description=preg_replace("/.0$/", ".x", mysql_result($result,$i,"description"));
       $level=mysql_result($result,$i,"level");
       $dateorder=mysql_result($result,$i,"released");
       $bugnumber=mysql_result($result,$i,"bugnumber");
       $id=mysql_result($result,$i,"id");
       $detail=mysql_result($result,$i,"Notes");
       $releaseinfo=mysql_result($result,$i,"releaseinfo");
       if ($ord == "[CAT]")
       {
       ++$j;
       if ($j%2==0)
       {
       $div = "odd";
       }
       else
       { $div = "even"; }
       if ($i != 0) {
       Print "
   
       ";
       }
       if ($i==0)
       {
       Print "
       <div class='column_accordion'>
       <div class='accordion'>
       <div class='mfn-acc accordion_wrapper'>
       <div class='question active'>
       <h5 style='padding-bottom: 0px; white-space:nowrap'><span class='icon'><i class='icon-right-open'></i></span>
       <div class='HTNX_Header$div'>HireTrack NX version $description $releaseinfo $dateorder $level</div>";
       Print "</h5>
   
       ";
       Print "
       <div class='answer' style='display: block;'>";
       }
       else
       {
       Print "</div>
       <div class='question'>
       <h5><span class='icon'><i class='icon-right-open'></i></span>
       <div class='HTNX_Header$div'>HireTrack NX version $description released on $dateorder $level</div>";
       Print "</h5>
   
       ";
       Print "
       <div class='answer'>";
       }}
       else
       {
       Print "
       <div class='HTNX_body$div'><a name='$id'></a>$level <small>$bugnumber</small></div>
       ";
       if ($detail != "")
       {
       Print "
       <div class='HTNX_Notes$div'>
   
       $detail
   
       </div>
   
       ";
       }
       }
       }
       Print "
       </div>
       </div>
       </div>
       </div>
       </div>
       </div>
       ";
       ```
   

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * (@webcraftic)
 * [8 years ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10423942)
 * Hi,
 * I need time to test your code. But the problem is in it, because the algorithm
   of the old and new plugin is no different.
 * Best regards, Alex
 *  Thread Starter [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * (@david_navigator)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10424532)
 * If you let me have an email address, I can send you the real credentials
 *     ```
       $user="php_XXXXXXX";
       $password="XXXXXXX";
       $database="mantis_XXXXXXX";
       mysql_connect("mysql.XXXXXXX.com",$user,$password);
       ```
   
 *  Plugin Author [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * (@webcraftic)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10424605)
 * It would be very good that I could test your request.
 * My email: [wordpress.webraftic@gmail.com](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/wordpress.webraftic@gmail.com?output_format=md)
 * Best regards, Alex
 *  Thread Starter [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * (@david_navigator)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10424754)
 * Many thanks. Sent
 *  Thread Starter [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * (@david_navigator)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10435718)
 * Wondered if you’d had any chance to see what’s going wrong ?
    I’ve updated to
   your latest version, but this code still doesn’t run as a snippet.
 * regards
 * David
 *  Plugin Author [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * (@webcraftic)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10436020)
 * Hi,
 * I tested your code, there are no errors in it and I thought in the new version
   of the plugin this problem would be completely eliminated. It’s very strange 
   why he does not want to work for you. Do you have a test site? I can fix the 
   error directly on it, and you’ll see that it will work with snippets.
 * My skype: iqueryable_fenom
 * You can contact me via Skype so that we can quickly solve your problem.
 * Best regards, Alex
    -  This reply was modified 7 years, 12 months ago by [webcraftic](https://wordpress.org/support/users/webcraftic/).
 *  Thread Starter [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * (@david_navigator)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10437325)
 * What time zone are you in and what is a good time to Skype ?
 *  Plugin Author [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * (@webcraftic)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10440128)
 * Hi,
 * I usually work in Central European Time. Just write to me, maybe I’ll be there
   at this time.
 * Best regards, Alex
 *  Thread Starter [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * (@david_navigator)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10440979)
 * For anyone else finding this issue in the future – the problem was due to the
   wordpress editor converting some of the quotes when I copied the code from the
   old tags to the new snippets. [@webcraftic](https://wordpress.org/support/users/webcraftic/)
   kindly identified those problems and the code is now working as expected 🙂

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Code doesn’t run in snippit’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [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/)

 * 9 replies
 * 2 participants
 * Last reply from: [david_navigator](https://wordpress.org/support/users/david_navigator/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/code-doesnt-run-in-snippit/#post-10440979)
 * Status: resolved