Well, I have this script to create an online text-based game, and it's not working at all. And the funny thing is that it worked some months ago, but I runned it at a webserver, now I'm doing it local.
Check the attachment.
Here's the code for the page news.php (nyheter).
<?PHP
include("config.php");
$dbres = mysql_query("SELECT * FROM `users` WHERE `login`='{$_SESSION['login']}'");
$data = mysql_fetch_object($dbres);
?>
<html>
<head>
<title>Beta</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table width="100%">
<tr>
<td class="subTitle"><b>Nyheter</b></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="mainTxt">**********<br>
<?
$pp = 10;
$start= ($_GET['p'] >= 0) ? $_GET['p']*$pp : 0;
$sql = mysql_query("SELECT id FROM `news`");
$rows = mysql_num_rows($sql);
if($start > $rows){
$start = 0;
}
$sql = mysql_query("SELECT * FROM `news` ORDER BY time DESC LIMIT $start,$pp");
while($news = mysql_fetch_object($sql)){
$time = date('d/m/Y', $news->time);
$title = $news->title;
$text = $news->text;
echo"<i><b>$title</b></i> $time<br><br>$text<br><br>**********<br><br>";
}
print " <tr><td align=\"center\">";
if($rows <= $pp){
print "<< < 1 > >>";
}
else {
if($start/$pp == 0){
print "<< < ";
}
else{
print "<a href=\"?p=0\"><<</a> <a href=\"?p=". ($start/$pp-1) ."\"><</a> ";
}
for($i=0; $i<$rows/$pp; $i++) {
if($i == $start/$pp){
print "<u>". ($i+1) ."</u> ";
}
else{
print "<a href=\"?p=$i\">". ($i+1) ."</a> ";
}
}
if($start+$pp >= $rows){
print " > >> ";
}
else{
print "<a href=\"?p=". ($start/$pp+1) ."\">></a> <a href=\"?p=". (ceil($rows/$pp)-1) ."\">>></a>";
}
}
?>
</td>
</tr>
</table>
</body>
</html>
I'm using WAMP 2.0i, here is my PHP, MySQL and Apache version:
PHP: 5.2.9-2
MySQL: 5.1.36
Apache: 2.2.11
I'm just taking a wild guess, could this be because of the versions of PHP or something? Is there any extensions of the PHP i should enable? Could anyone give me some help?
Thanks, Markz