Paging doesn't work

Hello,

I have paging working correctly for my blog.php file. This is displayed when visiting my index.php for the first time. The navigation links on the bottom of the page work fine as well.

There is a left column on the homepage with a search function. You can search for a title in the database. The results of the query are displayed correctly, but I can’t get paging to work correctly.
When I implement paging, the first page of results are displayed correctly including the navigation links on the bottom. When I click on the link NEXT (the one a have been testing with sofar) PHP comes up with 2 errors:

Warning: include(index.php?page=Title_search?start=5) [function.include]: failed to open stream: No error in C:\wamp\www\index.php on line 34

Warning: include() [function.include]: Failed opening ‘index.php?page=Title_search?start=5’ for inclusion (include_path=’.;C:\php\pear’) in C:\wamp\www\index.php on line 34

When hoovering over that link I can see that the link points to the location I expect it to do but the page doesn’t seem to exist.
I have no idea why. I am totally lost. Any help is much appreciated.

My code sofar:

index.php:
[php]

Blogging system, inzendopdracht 202J7
                              <div id="col1">
                              <?php
                              include('col1.php');
                           //  print("tekst voor kolom 1");
                              ?>
                              </div>

                              <div id="col2">
                              <?php
                                if (!isset($_GET['page']))
                                 {
        //url bestaat niet: beginpagina
                                 include('blog.php');

                                 }
                                 else {

                                                  if (preg_match('/start/', $_GET['page']))
                                                           {
                                                           $page = "index.php?page=" . $_GET['page'] ;
                                                           include($page);
                                                           }
                                                           else {

        //url bestaat wel: bestand
                                       $page = $_GET['page'].'.php';

                                      if (file_exists($page))
                                         {
        //bestand is er, laat zien
                                         include($page);
                                         }
                                         else {
        //pagina bestaat niet
                                              echo "$page . 'De opgevraagde pagina bestaat niet.";
                                              }
                                                               }
                                       }

                              ?>
                              </div>

                              <div id="col3">
                              <?php
                               include('col3.php');

                              ?>
                              </div>


                   </div>
             </div>
    </div>
[/php]

The blog.php (which works correctly):
[php]<?php

include(‘Include\function_connect.inc’);
include(‘Include\function_error_msg.inc’);
set_error_handler(“error_msg”);

connect_to_db();

$page_name=“index.php”; // If you use this code with a different page ( or file ) name then change this

if (isset($_GET[‘start’]))
{
$start=$_GET[‘start’];// To take care global variable if OFF
}
else{
$start = 0;
}

$eu = ($start - 0);
$limit = 5; // No of records to be shown per page.
$this_ = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;

     $query2 = "select Title, Body, date_format(DatumTijd, 'Geplaatst op %d-%m-%Y om %H:%i uur.')
                      from blog_artikel ORDER by Art_ID desc";
     $result2 = mysql_query($query2);

     $row_count = mysql_num_rows($result2);


     $query = "select Title, Body, date_format(DatumTijd, 'Geplaatst op %d-%m-%Y om %H:%i uur.')
                      from blog_artikel ORDER by Art_ID desc limit $eu, $limit ";

     $result = mysql_query($query) or die(mysql_error());

     while($row = mysql_fetch_array($result))
          {
                        print("<TABLE>");
                print("<TR>");
                  print("<td class=a>");

                  print(nl2br($row[0]));
                  print("</td><td class=b>");
                  print(nl2br($row[2]));
                  print("</td>");
                  print("</TR>");
                  print("<TR>");
                  print("<td class=c colspan=2>");
                  print(nl2br($row[1]));
                  print("</td>");
                  print("</TR>");

                  print("<TR>");
                  print("<td class=a>");
                             // print("<TD>" . nl2br($row[$column_num]) . "</TD>");
                  print("Reactie(X)");
                  print("</td><td class=b>");
                  print(" Reageer op deze post");
                  print("</td>");
                  print("</TR>");

                  print("</TABLE>");
                   ?>
                  <BR>
                      <?php

echo “

”;
}
print("

");
print("");
print("
");
         if($back >=0) {

print “PREV”;
}

$i=0;
$l=1;
for($i=0;$i < $row_count;$i=$i+$limit){

                                  if($i <> $eu){

echo " $l ";
}
else {
echo “$l”;
}
$l=$l+1;
}
if($this_ < $row_count)
{
print “NEXT”;
}

           print("</td>");
         print("</TR>");

         print("</TABLE>");

?>[/php]

The Title_search.php (which is driving me crazy):
[php]<?php

include(‘Include\function_connect.inc’);
include(‘Include\function_error_msg.inc’);
include(‘Include\function_paging.inc’);
connect_to_db();

set_error_handler(“error_msg”);

if (isset($_POST[‘Zoeken_titel’]))
{
if (!$_POST[‘title’] || $_POST[‘title’] == “” || strlen($_POST[‘title’]) < 2) //titleveld NIET goed???
{
print(“Vul een titel in.\n” );
print("U kunt pas verder als alle velden correct zijn ingevuld
");
}
else{
$title = addslashes($_POST[‘title’]);
$search_string = ‘%’ . $title . ‘%’;
$query2 = "SELECT Art_ID,Title, date_format(DatumTijd, ‘Geplaatst op %d-%m-%Y om %H:%i uur.’),
Body FROM blog_artikel WHERE title LIKE ‘$search_string’ ";
$result_2 = mysql_query($query2)
or die(mysql_error());

                 $row_count = mysql_num_rows($result_2);

              if ($row_count == 0)
              {
              print("Er zijn geen Posts gevonden waar" . "<div id=\"red\">" . $_POST['title'] . "</div>" . "in voor komt.");
              }
          else{

          $page_name="index.php";

if (isset($_GET[‘start’]))
{
$start=$_GET[‘start’];
}
else{
$start = 0;
}

$eu = ($start - 0);
$limit = 5; // No of records to be shown per page.
$this_ = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;

     $result2 = mysql_query($query2);

     $row_count = mysql_num_rows($result2);

        $query1 = $query2 . "limit " . $eu . $limit;

           $result = mysql_query($query1) or die(mysql_error());

     while($row = mysql_fetch_array($result))


          {
                       print("<TABLE>");
                       print("<TR>");                                                  //regel 1
                       print("<td class=a>");

                       print(nl2br($row[1]));
                       print("</td><td class=b>");
                       print(nl2br($row[2]));
                       print("</td>");
                       print("</TR>");
                       print("<TR>");                                                       //regel 2
                       print("<td class=c colspan=2>");
                       print(nl2br($row[3]));
                       print("</td>");
                       print("</TR>");
                        print("<TR>");
                  print("<td class=a>");

                  print("Reactie(X)");
                  print("</td><td class=b>");
                  print(" Reageer op deze post");
                  print("</td>");
                  print("</TR>");
                       print("</TABLE> . <BR>");
          }

print("

");
print("");
print("");
print("");
         print("</TABLE>");
              }
         }

}
?>[/php]

");
         if($back >=0) {

print “PREV”;
}

$i=0;
$l=1;
for($i=0;$i < $row_count;$i=$i+$limit){

                                  if($i <> $eu){

echo " $l “;
}
else {
echo “$l”;
}
$l=$l+1;
}
if($this_ < $row_count)
{
print “<a href=” . $page_name . “?page=” . $_GET[‘page’] . “?start=” . $next . “>NEXT”;
}
print(”

Sponsor our Newsletter | Privacy Policy | Terms of Service