0

my page ain't loading.. i think it its from the my comment querires .. pls some one help out

<?php

require_once 'dbconnect.php';

//select full thread from thread table

$selFull = "SELECT * FROM frthreads WHERE threadId=".$_GET['threadId'];
$selFullChck = mysqli_query($con, $selFull);

$commentquery = "SELECT * FROM frcomments WHERE threadId =3";
    $commentQuery = mysqli_query($con, $commentquery);

?>

<!DOCTYPE html>
<html>
<head>
<title>TEST PAGE </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <link rel="stylesheet" type="" href="css/bootstrap.min.css"/>
    <link rel="stylesheet" type="" href="css/font-awesome.min.css"/>
    <link rel="stylesheet" type="" href="css/test.css"/>
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
    <link rel="stylesheet" href="css/ionicons.css" type="">

    <style>
/* Center the loader */
#loader {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;
  border: 16px solid #f3f363;
  border-radius: 50%;
  border-top: 16px solid #3496db;
  border-top: 16px solid lightblue;
  border-right: 16px solid lightgreen;
  border-bottom: 16px solid #336c9c;
  width: 120px;
  height: 120px;
  -webkit-animation: spin 1s linear infinite;
  animation: spin 1s linear infinite;
}

@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Add animation to "page content" */
.animate-bottom {
  position: relative;
  -webkit-animation-name: animatebottom;
  -webkit-animation-duration: 1s;
  animation-name: animatebottom;
  animation-duration: 1s
}

@-webkit-keyframes animatebottom {
  from { bottom:-100px; opacity:0 } 
  to { bottom:0px; opacity:1 }
}

@keyframes animatebottom { 
  from{ bottom:-100px; opacity:0 } 
  to{ bottom:0; opacity:1 }
}

#myDiv {
  display: none;
}
</style>

</head>
<body class="" style="background-color: white;"  onload="myFunction()">

        <div id="loader"></div>
            <div style="display:none;padding: 16px;" id="myDiv" class="animate-bottom">

                <button onclick="topFunction()" id="MyTopBtn" title="Go to top">Top</button>
                <nav class="navbar navbar-default navbar-fixed-top" style="background-color: #dfdbdb;">
                <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="container">
                    <div class="navbar-header">
                      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                      </button>
                      <a class="navbar-brand" href="#">JUSTIFIED HOME</a>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse center-block" id="bs-example-navbar-collapse-1">
                      <ul class="nav navbar-nav" style="margin-left: 20px;">
                            <li><a href="#"><span class=""><i class="icon ion-home"></i> HOME</span></a></li>
                            <li><a href="#"><span class=""><i class="fa fa-book"></i> BLOG</span></a></li>
                            <li><a href="#"><span class=""><i class="icon ion-ios-film"></i> VIDEOS</span></a></li>
                            <li><a href="#"><span class=""><i class="icon ion-log-in"></i> LOGIN</span></a></li>
                            <li><a href="#" class="notif"><span class=""><i class="fa fa-sign-in"></i> REGISTER</span></a></li>
                      </ul>
                        <form class="navbar-form navbar-right" style="margin-right: 20px;">
                                <div class="input-group">
                                    <input type="text" class="form-control" id="search" style="border-radius: 25px;"  placeholder="Search Here...">
                                            <div class="input-group-btn">
                                                    <!--<button class="btn btn-default" type="submit">
                                                        <i class="glyphicon glyphicon-search"></i>
                                                    </button>-->
                                            </div>
                                </div>
                        </form>
                    </div><!-- /.navbar-collapse -->
                   </div>   
                </nav>

                <br/><br/><br/>

                    <div class="container">

                        <div class="row">

                            <div class="col-sm-8">

                                <?php
                                while ($selFullRow = mysqli_fetch_array($selFullChck, MYSQLI_ASSOC)) {
                                    # code...
                                    $thread_id = $selFullRow['threadId'];
                                    $thread_title = $selFullRow['threadTitle'];
                                    $thread_body = $selFullRow['threadBody'];
                                    $thread_author = $selFullRow['threadAuthor'];

                                    $thread_date = $selFullRow['threadDate'];
                                        $threadDateFm = strtotime($thread_date);
                                        $threadDateFmNw = date("d, D, F Y  g:i A", $threadDateFm);

                                        $thread_cat = $selFullRow['threadCat'];

                                        $selCatname = "SELECT * FROM frcats WHERE catId='$thread_cat'";
                                        $selCatNameResult = mysqli_query($con, $selCatname);
                                        $selCatNameResultCount = mysqli_num_rows($selCatNameResult);

                                        if ($selCatNameResultCount > 0) {

                                            while ($selCatRow = mysqli_fetch_array($selCatNameResult)) {
                                                # code...
                                                $threadCatName = $selCatRow['catName'];
                                            }
                                        }

                                    ?>

                                    <div class="FullthreadDiv">
                                        <article>
                                                <a href=""><h1 id="thread_title"><?php echo $thread_title; ?></h1></a>
                                                <hr/>

                                                    <div id="FullThreadDivDetail">

                                                        <span><i class="icon ion-android-calendar"></i> <small style="font-size: 1em;"><?php echo $threadDateFmNw; ?></small></span>
                                                        &nbsp;<a href=""><span><i class="fa fa-user"></i> <small style="font-size: 1em;"><?php echo $thread_author; ?></small></span></a>
                                                        &nbsp;<a href=""><span><i class="icon ion-folder"></i> <small style="font-size: 1em;"><?php echo $threadCatName; ?></small></span></a>
                                                        &nbsp;<a href=""><span><i class="icon ion-chatboxes"></i> <small style="font-size: 1em;">Comments[5]</small></span></a>

                                                    </div>
                                                    <hr/>

                                                        <p id="thread_body"><?php echo $thread_body; ?></p>

                                                        <h3 style="color: #93b67b;">Comments.....</h3>
                                                        <div class="comment-block">
                                                        <?php 

                                                        while($commentRow = mysqli_fetch_array($commentQuery, MYSQLI_ASSOC)){ 

                                                                $name = $commentRow['comment_name'];
                                                                $comment = $commentRow['comment'];
                                                            ?>
                                                            <div class="comment-item">
                                                                <div class="comment-avatar">
                                                                    <!--<img src="<?php echo avatar($commentRow['mail']) ?>" alt="avatar">-->
                                                                </div>
                                                                <div class="comment-post">
                                                                    <h3><?php echo $name; ?> <span>said....</span></h3>
                                                                    <p><?php echo $comment; ?></p>
                                                                </div>
                                                            </div>
                                                        <?php } ?>
                                                        </div>

                                        </article>

                                        <?php

                                                }
                                                ?>
                                    </div>

                                    <section>
                                        <div class="comment-block">
                                            <fieldset>
                                                <h3 class="text-leave-comment">Leave comment :: Reply to Thread...</h3>

                                                <form id="form" method="POST" action="ajax_comment.php">

                                                    <!-- need to supply post id with hidden fild -->
                                                    <input type="hidden" name="thread_id" value="<?php echo $thread_id; ?>">

                                                    <div class="form-group">
                                                        <label for="name" style="font-size: 17px;">Name</label>
                                                            <input type="text" required="" name="comment-name" placeholder="Your name here ..." class="form-control inputReg" />
                                                    </div>

                                                    <div class="form-group">
                                                        <label for="comment" style="font-size: 17px;">Reply</label>
                                                        <textarea name="comment"  placeholder="Your comment/reply here ..." rows="5" class="form-control inpuutTxtarea" required="" style="resize: none;"></textarea>
                                                    </div>

                                                    <div class="form-group">
                                                        <input type="submit" id="submit" class="btn btn-primary btn-comment" name="submit-comment" value="COMMENT" />
                                                    </div>

                                                </form>
                                            </fieldset>
                                        </div>
                                    </section>

                            </div>

                            <div class="col-xs-6 col-sm-4">
                                <?php include 'sidebar.php'; ?>
                            </div>

                        </div>

                    </div>

        </div>
    <script src="js/bootbox.min.js"></script>
    <script type="text/javascript" src="comment.js"></script>

    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/jquery-3.1.1.min.js"></script>

    <script type="text/javascript">

        // When the user scrolls down 20px from the top of the document, show the button
        window.onscroll = function() {scrollFunction()};

        function scrollFunction() {
        if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
            document.getElementById("MyTopBtn").style.display = "block";
        } else {
            document.getElementById("MyTopBtn").style.display = "none";
        }
            }

        // When the user clicks on the button, scroll to the top of the document
        function topFunction() {
            document.body.scrollTop = 0; // For Chrome, Safari and Opera 
            document.documentElement.scrollTop = 0; // For IE and Firefox
        }
    </script>

    <script>
    var myVar;

    function myFunction() {
    myVar = setTimeout(showPage, 3000);
    }

        function showPage() {
    document.getElementById("loader").style.display = "none";
    document.getElementById("myDiv").style.display = "block";
    }
</script>

</body>
</html>

and here is my ajax_comment page

<?php

include 'dbconnect.php';

if (!empty($_POST['comment-name']) AND !empty($_POST['comment']) AND !empty($_POST['thread_id'])) {
        $name = mysqli_real_escape_string($con, $_POST['comment-name']);
        $comment = mysqli_real_escape_string($con, $_POST['comment']);
        $thread_id = mysqli_real_escape_string($con, $_POST['thread_id']);

        $comment_query = "INSERT INTO frcomments (comment_name, comment, threadId) VALUES ('$name', '$comment', '$thread_id')"; 

        $commentQuery = mysqli_query($con, $comment_query);
    }

    ?>

    <div class="comment-item">
        <div class="comment-avatar">
            <img src="<?php echo avatar($mail) ?>" alt="avatar">
        </div>
        <div class="comment-post">
            <h3><?php echo $name ?> <span>said....</span></h3>
            <p><?php echo $comment?></p>
        </div>
    </div>

    ?>

Edited by destiny_3

2
Contributors
3
Replies
22
Views
1 Week
Discussion Span
Last Post by Subraa_1
0

Let me fix it!

If in case you get the answer meanwhile, do let me know!!

Thanks

0

I had tried few changes in your code in local. Will fix it soon.

Being busy with busy schedules!!

Mean while, should you get any solution, do let me know

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.