Jump to content

[SOLVED] how do i make mysql show all rows i select ?


jamesxg1

Recommended Posts

<?php session_start(); 

require("../db/db.php"); //include database file
require("../db/config.php"); //include configuration file
require("../db/util.php");
require("../db/settings.php");

isloggedin();
accessneeded("A");
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<?php
if(isset($_POST['delete'])) {
$reporteduser = strip_tags(mysql_real_escape_string($_POST['reporteduser']));
$reporter = strip_tags(mysql_real_escape_string($_POST['reporter']));
$report = strip_tags(mysql_real_escape_string($_POST['report']));
$userrep = strip_tags(mysql_real_escape_string($_POST['userrep']));
$implevel = strip_tags(mysql_real_escape_string($_POST['implevel']));$sql = "DELETE FROM reports WHERE id = '$id' AND reporteduser = '$reporteduser' AND reporter = '$reporter' AND report = '$report' AND implevel = '$implevel' AND status = '$status'";
mysql_query($sql) or die(mysql_error());
print ("<P ALIGN=CENTER>The user $userr has been reported to Admin.<br>Please Return Back To The <a href='../main/index.php'>Home Page</a></P>");
exit;
}

$query = "SELECT * FROM reports WHERE status = 'Pending' order by implevel";
$sqlreports = mysql_query($query);

if(!$sqlreports)
	{
	print ("<p><?php print '$query: '.$query.mysql_error();?></p>");
	}

if (!mysql_num_rows($sqlreports) )
	{
	print("<center><p><b>You have no new friend's requests!.</b></p></center>");
	}
print ("<P ALIGN=CENTER><h3>Reports:</h3></P>");
print ("<center>");
print ("<table border='3' width='400' cellpadding='5' bgcolor='#ffffff' bordercolor='#808080' style='border-collapse: collapse;' id=''>");
print ("<tr>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Id</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Reported User</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Report</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Reporter</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Implevel</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Status</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>Action</td>");
print ("<tr>");
	while($reports = mysql_fetch_array($sqlreports))
		{
		$id = $reports['id'];
		$reporteduser = $reports['reporteduser'];
		$report = $reports['report'];
                  $reporter = $reports['reporter'];
                  $implevel = $reports['implevel'];
                  $status = $reports['status'];

		}

print ("<td align='center' width='' bgcolor='#c0c0c0'>$id</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$reporteduser</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$report</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$reporter</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$implevel</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$status</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'><input type='submit' name='delete' value='Delete' id='$id'></td>");





print ("</tr>");

?>

 

 

Does anyone know how to make this display all the rows selected and not just one ?

Put this in the while loop:

 

print ("<td align='center' width='' bgcolor='#c0c0c0'>$id</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$reporteduser</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$report</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$reporter</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$implevel</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'>$status</td>");
print ("<td align='center' width='' bgcolor='#c0c0c0'><input type='submit' name='delete' value='Delete' id='$id'></td>");

 

Done!, Thankyou so much mate you havent just solver one thing here your have solved loads for me thanks again your a >>*<<

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.