• Resolved david_navigator

    (@david_navigator)


    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

    (@webcraftic)

    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

    (@david_navigator)

    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

    (@webcraftic)

    It would be very good that I could test your request.

    My email: [email protected]

    Best regards, Alex

    Thread Starter david_navigator

    (@david_navigator)

    Many thanks. Sent

    Thread Starter david_navigator

    (@david_navigator)

    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

    (@webcraftic)

    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 6 years, 5 months ago by webcraftic.
    Thread Starter david_navigator

    (@david_navigator)

    What time zone are you in and what is a good time to Skype ?

    Plugin Author webcraftic

    (@webcraftic)

    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

    (@david_navigator)

    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 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.