Jump to content
Stef's Coding Community
saversites

Why Query Fails To Pull Data From Data Base ?

Recommended Posts

image.thumb.png.835da3a1fd38fec846bfa049c101fd65.png

 

Folks,

Why are my $query_1 failing to pull data from mysql db ?
I created a condition to get alert if no result is found but I do not get the alert. That means result is found. But if found, then why the following code fails to display or echo the result through html ?

Trying to pull the data with these urls:
http://localhost/test/links_stats.php?Result_SearchType=Domain&Result_PageType=Information20%Page&Result_Domain=gmail.com&Result_LinksPerPage=25&Result_PageNumber=

http://localhost/test/links_stats.php?Result_SearchType=Page&Result_PageType=Information%20Page&Result_Page=http://go2.com/2.html&Result_LinksPerPage=25&Result_PageNumber=

http://localhost/test/COMPLETE/links_stats.php?Result_SearchType=Keywords&Result_PageType=Information20%Page&Result_Keywords=go2&Result_LinksPerPage=25&Result_PageNumber=

 

	<?php 
	//Required PHP Files. 
include 'config.php'; 
include 'header.php'; 
include 'account_header.php'; 
	if (!$conn) 
{ 
    $error = mysqli_connect_error(); 
    $errno = mysqli_connect_errno(); 
    print "$errno: $error\n"; 
    exit(); 
} 
else 
{     
    ?>
    <body bgcolor='blue'> 
    <?php     
    //Get the Page Number. Default is 1 (First Page). 
    $Result_PageNumber = $_GET["Result_PageNumber"]; 
    if ($Result_PageNumber == "") 
    { 
        $Result_PageNumber = 1; 
    } 
    
    $Result_LinksPerPage = $_GET["Result_LinksPerPage"]; 
    if ($Result_LinksPerPage == "") 
    { 
        $Result_LinksPerPage = 1; 
    } 
    
    $max_result = 100;     
    //$offset = ($Result_PageNumber*$Result_LinksPerPage)-$Result_LinksPerPage; 
    $offset = ($Result_PageNumber-1)*$Result_LinksPerPage; 
    
    if ($_GET["Result_SearchType"] == "Keywords") 
    { 
        //Grabbing these: $_GET["Result_PageType"],$_GET["Result_Keywords"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_Keywords"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND description = ? LIMIT ?"; 
        
        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND description = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2); 
    } 
    elseif ($_GET["Result_SearchType"] == "Domain") 
    { 
        //Grabbing these: $_GET["Result_Domain"], $_GET["Result_PageType"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_Domain"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND domain = ? LIMIT ?"; 
        
        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND domain = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2); 
    } 
    elseif ($_GET["Result_SearchType"] == "PageTitle") 
    { 
        //Grabbing these: $_GET["Result_pageTitle"], $_GET["Result_PageType"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_PageTitle"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND title = ?  LIMIT ?"; 
        
        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND title = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2); 
    } 
    elseif ($_GET["Result_SearchType"] == "Page") 
    { 
        //Grabbing these: $_GET["Result_Page"], $_GET["Result_PageType"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_Page"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND page = ? LIMIT ?"; 
	        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND page = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2);         
    } 
    elseif ($_GET["Result_SearchType"] == "PageDescription") 
    { 
        //Grabbing these: $_GET["Result_PageDescription"], $_GET["Result_PageType"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_PageDescription"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND description = ? LIMIT ?"; 
        
        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND description = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2); 
    } 
    elseif ($_GET["Result_SearchType"] == "AnchorText") 
    { 
        //Grabbing these: $_GET["Result_AnchorText"], $_GET["Result_PageType"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_AnchorText"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND anchor_text = ? LIMIT ?";     
    } 
        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND anchor_text = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2); 
        
        if(!$stmt_2) 
        { 
            ?> 
            <tr> 
            <td bgcolor="#FFFFFF">No record found! Try another time.</td> 
            </tr> 
            <?php 
        } 
        else 
        { 
            if(($offset+1)<=$max_result) 
            { 
                ?>
                <p align="left"> 
                <?php echo "<font color='white'><b>LINK SUBMISSION ID:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_Id</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>LINK SUBMISSION DATE & TIME:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_LinkSubmissionDateAndTime</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>DOMAIN:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_Domain</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>PAGE:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_Page</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>PAGE TYPE:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_PageType</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>PAGE TITLE:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_PageTitle</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>PAGE DESCRIPTION:</b></font>"; ?><br> 
                <?php echo "<font color='white'><i>$Result_PageDescription</i></font>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>PAGE SEARCH STATISTICS:</b></font>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Current&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='gold'><b>Current Visitor</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Last&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='silver'><b>Last Visitor</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Latest&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='bronze'><b>Latest Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Lost&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='grey'><b>Lost Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Unhappy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='yellow'><b>Unhappy Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Happy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='green'><b>Happy Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Competing&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='red'><b>Competing Visitors</font></b></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=All&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='blue'><b>All Visitors</font></b></a>"; ?><br> 
                <br> 
                <br> 
                <?php echo "<font color='white'><b>DOMAIN SEARCH STATISTICS:</b></font>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Current&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='gold'><b>Current Visitor</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Last&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='silver'><b>Last Visitor</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Latest&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='bronze'><b>Latest Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Lost&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='grey'><b>Lost Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Unhappy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='yellow'><b>Unhappy Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Happy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='green'><b>Happy Visitors</b></font></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Competing&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='red'><b>Competing Visitors</font></b></a>"; ?><br> 
                <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=All&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='blue'><b>All Visitors</font></b></a>"; ?><br> 
                <br> 
                <br> 
                </align> 
                <?php 
                //Use this technique: http://php.net/manual/en/mysqli-stmt.fetch.php
                while(mysqli_stmt_fetch($stmt_2)) 
                { 
                    ?> 
                    <p align="left"> 
                    <?php echo "<font color='white'><b>LINK SUBMISSION ID:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_Id</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>LINK SUBMISSION DATE & TIME:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_LinkSubmissionDateAndTime</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>DOMAIN:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_Domain</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>PAGE:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_Page</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>PAGE TYPE:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_PageType</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>PAGE TITLE:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_PageTitle</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>PAGE DESCRIPTION:</b></font>"; ?><br> 
                    <?php echo "<font color='white'><i>$Result_PageDescription</i></font>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>PAGE SEARCH STATISTICS:</b></font>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Current&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='gold'><b>Current Visitor</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Last&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='silver'><b>Last Visitor</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Latest&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='bronze'><b>Latest Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Lost&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='grey'><b>Lost Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Unhappy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='yellow'><b>Unhappy Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Happy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='green'><b>Happy Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=Competing&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='red'><b>Competing Visitors</font></b></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Keywords&Result_PageType=$Result_PageType&Result_Page=$Result_Page&Result_VisitorType=All&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='blue'><b>All Visitors</font></b></a>"; ?><br> 
                    <br> 
                    <br> 
                    <?php echo "<font color='white'><b>DOMAIN SEARCH STATISTICS:</b></font>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Current&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='gold'><b>Current Visitor</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Last&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='silver'><b>Last Visitor</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Latest&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='bronze'><b>Latest Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Lost&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='grey'><b>Lost Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Unhappy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='yellow'><b>Unhappy Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Happy&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='green'><b>Happy Visitors</b></font></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=Competing&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='red'><b>Competing Visitors</font></b></a>"; ?><br> 
                    <?php echo "<a href=\"visits_stats.php?Result_StatsType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_VisitorType=All&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber=\"><font color='blue'><b>All Visitors</font></b></a>"; ?><br> 
                    <br> 
                    <br> 
                    </align> 
                    <tr name="pagination"> 
                    <td colspan="10" bgcolor="#FFFFFF"> Result Pages: 
                    <?php              
                    if($Result_PageNumber<$total_pages) 
                    { 
                        for($i=1;$i<=$total_pages;$i++) //Show Page Numbers in Serial Order. Eg. 1,2,3.
                        echo "<a href=\"{$_SERVER['PHP_SELF']}?user=$user&Result_SearchType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber={$i}\">{$i}</a> "; 
                    }             
                    else 
                    { 
                        for($i=$total_pages;$i>=1;$i--) //Show Page Numbers in Reverse Order. Eg. 3,2,1.
                        echo "<a href=\"{$_SERVER['PHP_SELF']}?user=$user&Result_SearchType=Domain&Result_PageType=$Result_PageType&Result_Domain=$Result_Domain&Result_LinksPerPage=$Result_LinksPerPage&Result_PageNumber={$i}\">{$i}</a> "; 
                    } 
                    ?> 
                    </td> 
                    </tr> 
                    <?php 
                } 
            } 
        } 
    ?>   
    </table>     
    <br> 
    <br> 
    <p align="center"><span style="font-weight:bold;"><?php echo "Search Result: <br>Searching for ...\"$second_param\" <br>Page Type: $first_param<br> Matches: $matching_rows_count <br>"; ?></span></align> 
    <br> 
    </div> 
    <br> 
    </body> 
    </html>
	

 

Edited by saversites

Share this post


Link to post
Share on other sites

I have error reporting on on one of the included files. Not getting any error.

<?php 
	//ERROR REPORTING CODES.
declare(strict_types=1);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
?>

Ok, I will shorten the code in this example below. The mysql queries are not working.

if ($_GET["Result_SearchType"] == "Domain") 
    { 
        //Grabbing these: $_GET["Result_Domain"], $_GET["Result_PageType"]. 
        $first_param = $_GET["Result_PageType"]; 
        $second_param = $_GET["Result_Domain"]; echo "$second_param"; 
        $query_1 = "SELECT COUNT(*) FROM submissions_index WHERE page_type = ? AND domain = ? LIMIT ?"; 
        
        $stmt_1 = mysqli_prepare($conn,$query_1); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        mysqli_stmt_execute($stmt_1); 
        $result_1 = mysqli_stmt_bind_result($stmt_1,$matching_rows_count); 
        mysqli_stmt_fetch($stmt_1); 
        mysqli_stmt_free_result($stmt_1); 
        
        $total_pages = ceil($matching_rows_count/$Result_LinksPerPage); 
        $query_2 = "SELECT id,date_and_time,domain,page_type,page,title,description FROM submissions_index WHERE page_type = ? AND domain = ? LIMIT ?"; 
        $stmt_2 = mysqli_prepare($conn,$query_2); 
        mysqli_stmt_bind_param($stmt_1,'ssi',$first_param,$second_param,$Result_LinksPerPage); 
        $result_2 = mysqli_stmt_bind_result($stmt_2,$Result_Id,$Result_LinkSubmissionDateAndTime,$Result_Domain,$Result_PageType,$Result_Page,$Result_PageTitle,$Result_PageDescription); 
        mysqli_stmt_fetch($stmt_2); 

This Url should pull the data from the db tbl since there atleast one match for the query:
http://localhost/test/links_stats.php?Result_SearchType=Domain&Result_PageType=Information20%PAge&Result_Domain=gmail.com&Result_LinksPerPage=25&Result_PageNumber=

Look for img in previous post for what my mysql tbl lpooks like.
 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...