pages link more than one doesnt work in php search pagination












0















I want to have a search on my database , and also at the begining , when the search button is not clicked , it shows all the table rows.



The problem is when I do the search. For example: the result has two pages , when I click on page 2 , it shows the page 2 of the entire database table instead of my search result.



////////////////////////////////////pagination/////////////////////////////
$per_page = 20;
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start = $per_page * $page;
$start = $start - $per_page;

if (isset($_POST['search']))
{

$sharh = ($_POST['sharh']);
$mark = ($_POST['mark']);

$query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
$result2 = mysqli_query($db,$query2);
}
else
{
$query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl";
$result2 = mysqli_query($db,$query2);
}


echo " <form method='post' enctype='multipart/form-data'>
<table class='blueTable'><thead><tr><th>شماره</th><th>شرح کالا</th><th>مارک</th><th>تعداد1</th><th>قیمت غیر نقدی 1</th><th>قیمت نقدی 1</th><th>تعداد 2</th><th>قیمت غیرنقدی 2</th><th>قیمت نقدی 2</th><th>تعداد 3</th><th>قیمت غیرنقدی 3</th><th>قیمت نقدی 3</th><th>افزایش قیمت</th></tr></thead>";

while($row = $result->fetch_assoc())
{
echo "<tr><td>".$row["id"]."</td><td>".$row["sharhe_kala"]."</td><td>".$row["Mark"]."</td><td>".$row["tedad1"]."</td><td>".$row["price_gheyrnaqd1"]."</td><td>".$row["price_naqd1"]."</td><td>".$row["tedad2"]."</td><td>".$row["price_gheyrnaqd2"]."</td><td>".$row["price_naqd2"]."</td><td>".$row["tedad3"]."</td><td>".$row["price_gheyrnaqd3"]."</td><td>".$row["price_naqd3"]."</td><td>".$row["Afzayeshqeymat"]."</td></tr>";
}
echo "</table></form> ";



$total = mysqli_fetch_assoc($result2);
$total_page = (ceil($total['total'] / $per_page));
echo"<table class='pagination'>";
$prev = $page-1;
if($page <=1) {
echo "
<td> << </td>
";
}else {
echo "
<td><a href="?page=".$prev.""> << </a></td>
";
}

for($i=1;$i<=$total_page;$i++){

if($i==$page) {
echo "
<td class='active'>$i</td>
";
}
else {
echo "
<td><a href="?page=".$i."">".$i."</a></td>
";
}
}
$next = $page+1;
if($page>=$total_page) {
echo "
<td>>></td>
";
} else {
echo "
<td><a href="?page=$next"> >></a></td>
";
}
echo"</table>";









share|improve this question

























  • When you click on page 2 there is no $_POST['search'] and the code goes to the else statement so you will get no filtered results.

    – Kurohige
    Nov 24 '18 at 7:59











  • yes but what should i do ? when it goes to page 2 there is not button clicked and no textbox filled , so it execute "else" . but i dont know how can i prevent it

    – Za Gol
    Nov 24 '18 at 8:37











  • I removed if clause, inorder to the lines inside if, execute without any condition. now when i click on page2 it shows empty table

    – Za Gol
    Nov 24 '18 at 8:43











  • 1) on search click fill the form with post data. 2) make the pagination links able to differentiate if is searching results. 3) change your if else logic in order to manage any case.

    – Kurohige
    Nov 24 '18 at 8:44
















0















I want to have a search on my database , and also at the begining , when the search button is not clicked , it shows all the table rows.



The problem is when I do the search. For example: the result has two pages , when I click on page 2 , it shows the page 2 of the entire database table instead of my search result.



////////////////////////////////////pagination/////////////////////////////
$per_page = 20;
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start = $per_page * $page;
$start = $start - $per_page;

if (isset($_POST['search']))
{

$sharh = ($_POST['sharh']);
$mark = ($_POST['mark']);

$query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
$result2 = mysqli_query($db,$query2);
}
else
{
$query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl";
$result2 = mysqli_query($db,$query2);
}


echo " <form method='post' enctype='multipart/form-data'>
<table class='blueTable'><thead><tr><th>شماره</th><th>شرح کالا</th><th>مارک</th><th>تعداد1</th><th>قیمت غیر نقدی 1</th><th>قیمت نقدی 1</th><th>تعداد 2</th><th>قیمت غیرنقدی 2</th><th>قیمت نقدی 2</th><th>تعداد 3</th><th>قیمت غیرنقدی 3</th><th>قیمت نقدی 3</th><th>افزایش قیمت</th></tr></thead>";

while($row = $result->fetch_assoc())
{
echo "<tr><td>".$row["id"]."</td><td>".$row["sharhe_kala"]."</td><td>".$row["Mark"]."</td><td>".$row["tedad1"]."</td><td>".$row["price_gheyrnaqd1"]."</td><td>".$row["price_naqd1"]."</td><td>".$row["tedad2"]."</td><td>".$row["price_gheyrnaqd2"]."</td><td>".$row["price_naqd2"]."</td><td>".$row["tedad3"]."</td><td>".$row["price_gheyrnaqd3"]."</td><td>".$row["price_naqd3"]."</td><td>".$row["Afzayeshqeymat"]."</td></tr>";
}
echo "</table></form> ";



$total = mysqli_fetch_assoc($result2);
$total_page = (ceil($total['total'] / $per_page));
echo"<table class='pagination'>";
$prev = $page-1;
if($page <=1) {
echo "
<td> << </td>
";
}else {
echo "
<td><a href="?page=".$prev.""> << </a></td>
";
}

for($i=1;$i<=$total_page;$i++){

if($i==$page) {
echo "
<td class='active'>$i</td>
";
}
else {
echo "
<td><a href="?page=".$i."">".$i."</a></td>
";
}
}
$next = $page+1;
if($page>=$total_page) {
echo "
<td>>></td>
";
} else {
echo "
<td><a href="?page=$next"> >></a></td>
";
}
echo"</table>";









share|improve this question

























  • When you click on page 2 there is no $_POST['search'] and the code goes to the else statement so you will get no filtered results.

    – Kurohige
    Nov 24 '18 at 7:59











  • yes but what should i do ? when it goes to page 2 there is not button clicked and no textbox filled , so it execute "else" . but i dont know how can i prevent it

    – Za Gol
    Nov 24 '18 at 8:37











  • I removed if clause, inorder to the lines inside if, execute without any condition. now when i click on page2 it shows empty table

    – Za Gol
    Nov 24 '18 at 8:43











  • 1) on search click fill the form with post data. 2) make the pagination links able to differentiate if is searching results. 3) change your if else logic in order to manage any case.

    – Kurohige
    Nov 24 '18 at 8:44














0












0








0








I want to have a search on my database , and also at the begining , when the search button is not clicked , it shows all the table rows.



The problem is when I do the search. For example: the result has two pages , when I click on page 2 , it shows the page 2 of the entire database table instead of my search result.



////////////////////////////////////pagination/////////////////////////////
$per_page = 20;
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start = $per_page * $page;
$start = $start - $per_page;

if (isset($_POST['search']))
{

$sharh = ($_POST['sharh']);
$mark = ($_POST['mark']);

$query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
$result2 = mysqli_query($db,$query2);
}
else
{
$query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl";
$result2 = mysqli_query($db,$query2);
}


echo " <form method='post' enctype='multipart/form-data'>
<table class='blueTable'><thead><tr><th>شماره</th><th>شرح کالا</th><th>مارک</th><th>تعداد1</th><th>قیمت غیر نقدی 1</th><th>قیمت نقدی 1</th><th>تعداد 2</th><th>قیمت غیرنقدی 2</th><th>قیمت نقدی 2</th><th>تعداد 3</th><th>قیمت غیرنقدی 3</th><th>قیمت نقدی 3</th><th>افزایش قیمت</th></tr></thead>";

while($row = $result->fetch_assoc())
{
echo "<tr><td>".$row["id"]."</td><td>".$row["sharhe_kala"]."</td><td>".$row["Mark"]."</td><td>".$row["tedad1"]."</td><td>".$row["price_gheyrnaqd1"]."</td><td>".$row["price_naqd1"]."</td><td>".$row["tedad2"]."</td><td>".$row["price_gheyrnaqd2"]."</td><td>".$row["price_naqd2"]."</td><td>".$row["tedad3"]."</td><td>".$row["price_gheyrnaqd3"]."</td><td>".$row["price_naqd3"]."</td><td>".$row["Afzayeshqeymat"]."</td></tr>";
}
echo "</table></form> ";



$total = mysqli_fetch_assoc($result2);
$total_page = (ceil($total['total'] / $per_page));
echo"<table class='pagination'>";
$prev = $page-1;
if($page <=1) {
echo "
<td> << </td>
";
}else {
echo "
<td><a href="?page=".$prev.""> << </a></td>
";
}

for($i=1;$i<=$total_page;$i++){

if($i==$page) {
echo "
<td class='active'>$i</td>
";
}
else {
echo "
<td><a href="?page=".$i."">".$i."</a></td>
";
}
}
$next = $page+1;
if($page>=$total_page) {
echo "
<td>>></td>
";
} else {
echo "
<td><a href="?page=$next"> >></a></td>
";
}
echo"</table>";









share|improve this question
















I want to have a search on my database , and also at the begining , when the search button is not clicked , it shows all the table rows.



The problem is when I do the search. For example: the result has two pages , when I click on page 2 , it shows the page 2 of the entire database table instead of my search result.



////////////////////////////////////pagination/////////////////////////////
$per_page = 20;
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start = $per_page * $page;
$start = $start - $per_page;

if (isset($_POST['search']))
{

$sharh = ($_POST['sharh']);
$mark = ($_POST['mark']);

$query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
$result2 = mysqli_query($db,$query2);
}
else
{
$query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl";
$result2 = mysqli_query($db,$query2);
}


echo " <form method='post' enctype='multipart/form-data'>
<table class='blueTable'><thead><tr><th>شماره</th><th>شرح کالا</th><th>مارک</th><th>تعداد1</th><th>قیمت غیر نقدی 1</th><th>قیمت نقدی 1</th><th>تعداد 2</th><th>قیمت غیرنقدی 2</th><th>قیمت نقدی 2</th><th>تعداد 3</th><th>قیمت غیرنقدی 3</th><th>قیمت نقدی 3</th><th>افزایش قیمت</th></tr></thead>";

while($row = $result->fetch_assoc())
{
echo "<tr><td>".$row["id"]."</td><td>".$row["sharhe_kala"]."</td><td>".$row["Mark"]."</td><td>".$row["tedad1"]."</td><td>".$row["price_gheyrnaqd1"]."</td><td>".$row["price_naqd1"]."</td><td>".$row["tedad2"]."</td><td>".$row["price_gheyrnaqd2"]."</td><td>".$row["price_naqd2"]."</td><td>".$row["tedad3"]."</td><td>".$row["price_gheyrnaqd3"]."</td><td>".$row["price_naqd3"]."</td><td>".$row["Afzayeshqeymat"]."</td></tr>";
}
echo "</table></form> ";



$total = mysqli_fetch_assoc($result2);
$total_page = (ceil($total['total'] / $per_page));
echo"<table class='pagination'>";
$prev = $page-1;
if($page <=1) {
echo "
<td> << </td>
";
}else {
echo "
<td><a href="?page=".$prev.""> << </a></td>
";
}

for($i=1;$i<=$total_page;$i++){

if($i==$page) {
echo "
<td class='active'>$i</td>
";
}
else {
echo "
<td><a href="?page=".$i."">".$i."</a></td>
";
}
}
$next = $page+1;
if($page>=$total_page) {
echo "
<td>>></td>
";
} else {
echo "
<td><a href="?page=$next"> >></a></td>
";
}
echo"</table>";






php forms pagination






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 8:56









Kurohige

5881420




5881420










asked Nov 24 '18 at 7:32









Za GolZa Gol

429




429













  • When you click on page 2 there is no $_POST['search'] and the code goes to the else statement so you will get no filtered results.

    – Kurohige
    Nov 24 '18 at 7:59











  • yes but what should i do ? when it goes to page 2 there is not button clicked and no textbox filled , so it execute "else" . but i dont know how can i prevent it

    – Za Gol
    Nov 24 '18 at 8:37











  • I removed if clause, inorder to the lines inside if, execute without any condition. now when i click on page2 it shows empty table

    – Za Gol
    Nov 24 '18 at 8:43











  • 1) on search click fill the form with post data. 2) make the pagination links able to differentiate if is searching results. 3) change your if else logic in order to manage any case.

    – Kurohige
    Nov 24 '18 at 8:44



















  • When you click on page 2 there is no $_POST['search'] and the code goes to the else statement so you will get no filtered results.

    – Kurohige
    Nov 24 '18 at 7:59











  • yes but what should i do ? when it goes to page 2 there is not button clicked and no textbox filled , so it execute "else" . but i dont know how can i prevent it

    – Za Gol
    Nov 24 '18 at 8:37











  • I removed if clause, inorder to the lines inside if, execute without any condition. now when i click on page2 it shows empty table

    – Za Gol
    Nov 24 '18 at 8:43











  • 1) on search click fill the form with post data. 2) make the pagination links able to differentiate if is searching results. 3) change your if else logic in order to manage any case.

    – Kurohige
    Nov 24 '18 at 8:44

















When you click on page 2 there is no $_POST['search'] and the code goes to the else statement so you will get no filtered results.

– Kurohige
Nov 24 '18 at 7:59





When you click on page 2 there is no $_POST['search'] and the code goes to the else statement so you will get no filtered results.

– Kurohige
Nov 24 '18 at 7:59













yes but what should i do ? when it goes to page 2 there is not button clicked and no textbox filled , so it execute "else" . but i dont know how can i prevent it

– Za Gol
Nov 24 '18 at 8:37





yes but what should i do ? when it goes to page 2 there is not button clicked and no textbox filled , so it execute "else" . but i dont know how can i prevent it

– Za Gol
Nov 24 '18 at 8:37













I removed if clause, inorder to the lines inside if, execute without any condition. now when i click on page2 it shows empty table

– Za Gol
Nov 24 '18 at 8:43





I removed if clause, inorder to the lines inside if, execute without any condition. now when i click on page2 it shows empty table

– Za Gol
Nov 24 '18 at 8:43













1) on search click fill the form with post data. 2) make the pagination links able to differentiate if is searching results. 3) change your if else logic in order to manage any case.

– Kurohige
Nov 24 '18 at 8:44





1) on search click fill the form with post data. 2) make the pagination links able to differentiate if is searching results. 3) change your if else logic in order to manage any case.

– Kurohige
Nov 24 '18 at 8:44












1 Answer
1






active

oldest

votes


















0














I changed the url to :



 else {
echo "
<td><a href="?page=".$i."&sharh=".$sharh."&mark=".$mark."">".$i."</a></td> ";
}


and add some condition :



if(isset($_GET['mark']) or isset($_GET['mark']))  // if anything in url
{
$mark = $_GET['mark'];
$sharh = $_GET['sharh'];
}
else //first time that search button clicked and there is no url link
{
$sharh = ($_POST['sharh']);
$mark = ($_POST['mark']);
}
$query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
$result2 = mysqli_query($db,$query2);

if ($mark=="" and $sharh=="") //if not searching
{
$query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
$result = mysqli_query($db,$query);

$query2 = "SELECT COUNT(*) as total FROM shams_tbl";
$result2 = mysqli_query($db,$query2);
}





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53456137%2fpages-link-more-than-one-doesnt-work-in-php-search-pagination%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I changed the url to :



     else {
    echo "
    <td><a href="?page=".$i."&sharh=".$sharh."&mark=".$mark."">".$i."</a></td> ";
    }


    and add some condition :



    if(isset($_GET['mark']) or isset($_GET['mark']))  // if anything in url
    {
    $mark = $_GET['mark'];
    $sharh = $_GET['sharh'];
    }
    else //first time that search button clicked and there is no url link
    {
    $sharh = ($_POST['sharh']);
    $mark = ($_POST['mark']);
    }
    $query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
    $result = mysqli_query($db,$query);

    $query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
    $result2 = mysqli_query($db,$query2);

    if ($mark=="" and $sharh=="") //if not searching
    {
    $query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
    $result = mysqli_query($db,$query);

    $query2 = "SELECT COUNT(*) as total FROM shams_tbl";
    $result2 = mysqli_query($db,$query2);
    }





    share|improve this answer




























      0














      I changed the url to :



       else {
      echo "
      <td><a href="?page=".$i."&sharh=".$sharh."&mark=".$mark."">".$i."</a></td> ";
      }


      and add some condition :



      if(isset($_GET['mark']) or isset($_GET['mark']))  // if anything in url
      {
      $mark = $_GET['mark'];
      $sharh = $_GET['sharh'];
      }
      else //first time that search button clicked and there is no url link
      {
      $sharh = ($_POST['sharh']);
      $mark = ($_POST['mark']);
      }
      $query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
      $result = mysqli_query($db,$query);

      $query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
      $result2 = mysqli_query($db,$query2);

      if ($mark=="" and $sharh=="") //if not searching
      {
      $query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
      $result = mysqli_query($db,$query);

      $query2 = "SELECT COUNT(*) as total FROM shams_tbl";
      $result2 = mysqli_query($db,$query2);
      }





      share|improve this answer


























        0












        0








        0







        I changed the url to :



         else {
        echo "
        <td><a href="?page=".$i."&sharh=".$sharh."&mark=".$mark."">".$i."</a></td> ";
        }


        and add some condition :



        if(isset($_GET['mark']) or isset($_GET['mark']))  // if anything in url
        {
        $mark = $_GET['mark'];
        $sharh = $_GET['sharh'];
        }
        else //first time that search button clicked and there is no url link
        {
        $sharh = ($_POST['sharh']);
        $mark = ($_POST['mark']);
        }
        $query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
        $result = mysqli_query($db,$query);

        $query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
        $result2 = mysqli_query($db,$query2);

        if ($mark=="" and $sharh=="") //if not searching
        {
        $query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
        $result = mysqli_query($db,$query);

        $query2 = "SELECT COUNT(*) as total FROM shams_tbl";
        $result2 = mysqli_query($db,$query2);
        }





        share|improve this answer













        I changed the url to :



         else {
        echo "
        <td><a href="?page=".$i."&sharh=".$sharh."&mark=".$mark."">".$i."</a></td> ";
        }


        and add some condition :



        if(isset($_GET['mark']) or isset($_GET['mark']))  // if anything in url
        {
        $mark = $_GET['mark'];
        $sharh = $_GET['sharh'];
        }
        else //first time that search button clicked and there is no url link
        {
        $sharh = ($_POST['sharh']);
        $mark = ($_POST['mark']);
        }
        $query = "SELECT * FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' LIMIT $start , $per_page";
        $result = mysqli_query($db,$query);

        $query2 = "SELECT COUNT(*) as total FROM shams_tbl WHERE sharhe_kala='$sharh' OR Mark='$mark' ";
        $result2 = mysqli_query($db,$query2);

        if ($mark=="" and $sharh=="") //if not searching
        {
        $query = "SELECT * FROM shams_tbl LIMIT $start , $per_page";
        $result = mysqli_query($db,$query);

        $query2 = "SELECT COUNT(*) as total FROM shams_tbl";
        $result2 = mysqli_query($db,$query2);
        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 9:29









        Za GolZa Gol

        429




        429






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53456137%2fpages-link-more-than-one-doesnt-work-in-php-search-pagination%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)