• Resolved jefflaws1

    (@jefflaws1)


    running php_everywhere to render a table of query results breaks the page layout, quicklinks drop out of the admin bar when logged in and the table displays below the footer and side bars, anyone have an idea as to why?

    Thanks in anticipation.

    Jeff

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    I’m not familiar with “php everywhere”. I see you’ve posted in their forum, too.

    1) How/where are you inserting the code? Shortcode or something else?

    2) Show your code on pastebin.com or gist.github.com and put a link here.

    The table appears *after* the footer content in your page source.

    You should ask in the plugin’s support forum.
    https://ww.wp.xz.cn/support/plugin/php-everywhere/

    Thread Starter jefflaws1

    (@jefflaws1)

    Hi Steve, thank you for your reply. php everywhere adds a block to page editing to paste your code into and then on the main content block in the editor you just call [php everywhere] where you want the code to display.

    The php code is this:
    <?php
    include(“Getit.php”);
    $famname = htmlspecialchars($_POST[‘familyname’]);
    $firstn = htmlspecialchars($_POST[‘firstname’]);
    $year = htmlspecialchars($_POST[‘year’]);
    $war = htmlspecialchars($_POST[‘war’]);
    $cemetery=htmlspecialchars($_POST[‘cemetery’]);
    $conn = new mysqli($host, $user, $pass, $db_name);
    // Check connection
    if ($conn_connect_error) {
    die(“Connection failed: ” . $conn_connect_error);
    }

    $sql = “select * from memorials where Surname like ‘$famname%’ and FirstName like ‘$firstn%’ and Cemetery like ‘%$cemetery%’ and Date_Of_Death like ‘$year%’ and War like ‘$war%’ ORDER BY Surname”;
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {

    echo”
    <table class=’pdres’ width=’100%’>
    <thead>

    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’>Surname</th>
    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’>First Name</th>
    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’>Cemetery</th>
    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’>War</th>
    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’>Date Of Death</th>
    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’>Date Of Birth</th>
    <th class=’sresh’ style=’color:#733b17; border: 1px #733b17 solid;’></th>
    </thead
    “;
    while($row = $result->fetch_assoc()){
    $str = ‘More‘;

    echo”
    <tbody>
    <tr class=’sres’>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $row[‘Surname’] . “</td>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $row[‘FirstName’] . “</td>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $row[‘Cemetery’] . “</td>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $row[‘War’] . “</td>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $row[‘Date_Of_Death’] . “</td>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $row[‘Date_Of_Birth’] . “</td>
    <td class=’sres’ style=’color:#733b17; border: 1px #733b17 solid;’>” . $str . “</td>
    </tbody>”;
    }
    }

    $conn->close();
    ?>
    Once edited and published if I visit the site while logged in the quick links in the admin bar drop down and out of the normal admin bar almost as if there is a break somewhere.

    I am no expert when it comes to wordpress or php but before the last update everything was working fine under WP Exec PHP then it went to pot.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    It’s a shortcode, so you cannot echo. Stuff everything into a string, then return that string at the end of your function.

    Also, it’s good practice not to put the styles inline. Assign classes to your elements, then put the styles in your CSS file (or use the customizer’s “additonal css”.

    Thread Starter jefflaws1

    (@jefflaws1)

    Thanks Steve but it turns out to be me being thick and stupid and not closing the table in the right place. Couple of hours re reading my own code and “hey presto” page works.

    Many thanks

    Jeff.

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

The topic ‘Layout problem’ is closed to new replies.