I've been staring at this code all night, and I can't see what I'm messing up on, its working fine until
while($row = mysql_fetch_array($result)){
the $row doesn't return any value from what I've tried.
for example I would take it out of the while loop and then try to echo $row['Date'] and nothing is outputted.
i wish i could be more specific in what was going wrong, but I can't seem to find my error.
Thanks in advance for the help
<?php
session_start();
require("./database.php");
$db = new database();
$user = $_GET['user'];
$inout = $_GET['inout'];
$page = $_GET['page']-1;
if($page = 0)
$start = 0;
else
$start = $page + 4;
$rpp = 5;
if($inout == 'Reciever')
$other = 'sender';
else
$other = 'reciever';
if($inout == 'Reciever'){
echo $inout;
echo $user;
$result = mysql_query("SELECT * FROM Vir.PM WHERE Reciever='$user' ORDER BY TimeStamp DESC LIMIT $start, $rpp");
$countresult = mysql_query("SELECT COUNT(*) FROM vir.PM WHERE Reciever='$user'");
}
if($inout == 'Sender'){
echo $inout;
echo $user;
$result = mysql_query("SELECT * FROM Vir.PM WHERE Sender='$user' ORDER BY TimeStamp DESC LIMIT $start, $rpp");
$countresult = mysql_query("SELECT COUNT(*) FROM vir.PM WHERE Sender='$user'");
}
$issue = mysql_query("SELECT * FROM Vir.users WHERE Alias = '$_SESSION[Alias]'");
$countrow = mysql_fetch_array($countresult);
$col = mysql_fetch_array($issue);
$count = $countrow['COUNT(*)'];
if($_SESSION['LoggedIn'] != TRUE) {
header('Location: ./login.php');
}
if($_SESSION['LoggedIn'] == TRUE && $col['Admin'] == TRUE) {
echo ("
<a href='./info.php?user=$user&inout=Reciever&page=1'>Recieved</a> |
<a href='./info.php?user=$user&inout=Sender&page=1'>Sent</a>
");
while($row = mysql_fetch_array($result)){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Info</title>
</head>
<body>
<?php
echo ("<table border=0>
<tr>
<td width=100>$row[$other]</a></td>
<td width=150>$row[Date]</td>
</tr>
</table>
<table border=0>
<tr>
<td width=250>$row[Subject]</td>
</tr>
</table>
<table border=1>
<tr>
<td width=250>$row[Message]</td>
</tr>
</table>
<br>
<br>
");
?>
</body>
<?php
}
}
if($count/$rpp > 1){
if($_GET['page'] > 1)
echo "<a href='info.php?user='$user'&inout='$inout'&page=".($_GET['page']-1)."'>prev</a> | ";
for($i = 1; $i <= $count / $rpp + 1; $i ++){
echo "<a href='info.php?user='$user'&inout='$inout'&page=$i'>$i</a>";
echo " | ";
}
echo " <a href='info.php?user='$user'&inout='$inout'&page=".($_GET['page']+1)."'>next</a>";
}
?>
</html>