Basicly, I planned on doing a "next/previous" button on my website, but they wont work, I think the problem lies in the server being in safe mode, I was hoping someone could show me how to get around it (keeping safe mode on) cheers heres my code

if(!isset($_GET['start'])) $start = 0;

// connect to the server
   @mysql_connect($host, $username, $password) or die ("SERVER CONNECTION ERROR");
   @mysql_select_db($database) or die ("DATABASE CONNECTION ERROR");

   
   // retrieve all the rows from the database//
   
$results = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT " . $start . ", 2") or die ("TROUBLE GETTING INFORMATION FROM THE DATABASE");
   $num     = mysql_num_rows($results);

$query = "SELECT count(*) as count FROM news";
$result= mysql_query($query);
$row = mysql_fetch_array($result);
$numrows= $row['count'];

   // print out the results
?>

<div align="center">
all messages are displayed in Decending order (newest first)<br>
<table>

<?
    if ($num == 0) {
    echo "no contacts to display";
    }
    else {

      while ($contact = mysql_fetch_row($results))
      {
         // print out the info
         $id = $contact[0];   
         $title = $contact[1];
         $message = $contact[2];

      
echo"<tr><td></td><td><b>";
echo" $title</b></td></tr><tr><td></td><td>";
echo"$message<hr></td></tr>";


      }
    }

echo "<br>";
if($start > 0) 
   echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 4) . 
        "\">Previous </a>\n";
echo "||";
if($numrows > ($start + 4)) 
   echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 4) . 
        "\">Next</a>\n";

?>

It might have to do with your server having register globals off. Instead of $PHP_SELF you should be using $_SERVER, etc.

Tried that before, didn't seem to help, I'll give it another bash, changed a few things since then, cheers

Tried that before, didn't seem to help, I'll give it another bash, changed a few things since then, cheers

You haven't really said what "won't work" means in this case. No results? Wrong results? Error messages?

well it will bring out the first page of results, but pressing the next button simply does nothing
have a look for your self Problem pages

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.