Found the problem and editted the code I posted above. The edit is the part in red. That should fix it.
Hope this helps.
Printable View
Found the problem and editted the code I posted above. The edit is the part in red. That should fix it.
Hope this helps.
Sorry I should have mentioned I spotted that and fixed it earlier, this is the error
I don't know if this helps but I can see a few yellow errors in dw when I look at it, it says </div> on line 150, </td> on line 151 and also </tr> on line 164... The dw error is MarkUp invalid because it's an overlapping or unclosed tag. But looked through it and they look fine to me could just be Dreamweaver being painful...Quote:
Parse error: parse error, expecting `']'' in \showMembers.php on line 158
Here it is, it is on this line, again editted the code I posted. Sorry about the miss.
Code:<td><?=$q['Email'];?></td>
Hi there... Damn it I missed that! :)
It doesn't like the last line the ?> closing tag...
ok, that's it. I think it is time for bed. Try adding the part in red to these lines:
Also editted the code that has been causing these errors. Sorry, but I'm getting offline to get ready for bed. Anyways, hope this helps.Code:if (empty($_GET['order'])) {
$order = LastName;
}
else {
$order = $_GET['order'];
}
Ok, I editted the code once again according to your screenshot. This should do it, but if not, let me know.
Hope this helps.Code:<?php
if ($_GET['cat'] == "") {
$cat = "A"; //set this to your default category
}
else {
$cat = $_GET['cat'];
}
/* connect to the mysql database and use a query to get the members info */
include 'library/config.php';
include 'library/opendb.php';
//navigation
include("nav.php");
//approved
$aCount = mysql_query("SELECT COUNT(*) FROM `tblmembers` WHERE `MemberApproved`='A'");
//deleted
$dCount = mysql_query("SELECT COUNT(*) FROM `tblmembers` WHERE `MemberApproved`='D'");
//on hold
$hCount = mysql_query("SELECT COUNT(*) FROM `tblmembers` WHERE `MemberApproved`='H'");
//pending
$pCount = mysql_query("SELECT COUNT(*) FROM `tblmembers` WHERE `MemberApproved`='P'");
//not sure
$nCount = mysql_query("SELECT COUNT(*) FROM `tblmembers` WHERE `MemberApproved`='N'");
//rejected
$rCount = mysql_query("SELECT COUNT(*) FROM `tblmembers` WHERE `MemberApproved`='R'");
if ($cat == "a") {
$field = "Approved";
$theCount = $aCount;
}
elseif ($cat == "d") {
$field = "Deleted";
$theCount = $dCount;
}
elseif ($cat == "h") {
$field = "On Hold";
$theCount = $hCount;
}
elseif ($cat == "p") {
$field = "Pending";
$theCount = $pCount;
}
elseif ($cat == "n") {
$field = "Not Sure";
$theCount = $nCount;
}
elseif ($cat == "r") {
$field = "Rejected";
$theCount = $rCount;
}
echo 'There are '.$theCount.' members that are '.$field;
/* if order is not set, or it is not in the allowed
* list, then set it to a default value. Otherwise,
* set it to what was passed in. */
if (empty($_GET['order'])) {
$order = 'LastName';
}
else {
$order = $_GET['order'];
}
if ($_REQUEST['act'] == "del") {
$del = $_REQUEST['del'];
mysql_query("UPDATE `tblmembers` SET `status`='D' WHERE `userID`='$del'");
header('Location: '.$_SERVER["PHP_SELF"]);
}
elseif ($_REQUEST['act'] == "edit") {
$id = $_REQUEST['id'];
$status = $_REQUEST['status'];
mysql_query("UPDATE `tblmembers` SET `status`='$status' WHERE `userID`='$id'");
header('Location: '.$_SERVER["PHP_SELF"]);
}
else {
/* construct and run our query */
$query = "SELECT * FROM tblmembers WHERE `MemberApproved`='$cat' ORDER BY `$order`";
$result = mysql_query ($query);
/* make sure data was retrieved */
$numrows = mysql_num_rows($result);
if ($numrows == 0) {
echo "No data to display!";
exit;
}
echo '<script type="text/javascript">
function showForm(id) {
obj = document.getElementById(\'edit_\'+id);
if (obj.style.display == "none") {
obj.style.display = "";
}
else {
obj.style.display = "none";
}
}
</script>
<table border="1">
<tr>
<td> </td>
<td> </td>
<td><a href="?order=FirstName">FirstName</a></td>
<td><a href="?order=LastName">LastName</a></td>
<td><a href="?order=PhoneNumber">PhoneNumber</a></td>
<td><a href="?order=MobileNumber">MobileNumber</a></td>
<td><a href="?order=Email">Email</a></td>
<td><a href="?order=City">City</a></td>
<td><a href="?order=State">State</a></td>
<td><a href="?order=JoinDate">JoinDate</a></td>
<td><a href="?order=MemberApproved">MemberApproved</a></td>
<td><a href="?order=loginDateTime">loginDateTime</a></td>
</tr>';
/* Now display the data */
while ($q = mysql_fetch_array($result)) {
?>
<tr>
<td><a href="#" onclick="showForm('<?php echo $q["id"];?>'); return false;">Edit</a>
<div id="edit_<?php echo $q['id'];?>" style="display: none;">
<!--status form-->
<form method="POST" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="hidden" name="act" value="edit">
<input type="hidden" name="id" value="<?php echo $q['id'];?>">
<select name="status">
<option value="A">Approved</option>
<!--enter options for status menu-->
</select>
</div>
</td>
<td><a href="?del=<?php echo $q['id'];?>&act=del">Delete User</a></td>
<td><?=$q['FirstName'];?></td>
<td><?=$q['LastName'];?></td>
<td><?=$q['PhoneNumber'];?></td>
<td><?=$q['MobileNumber'];?></td>
<td><?=$q['Email'];?></td>
<td><?=$q['City'];?></td>
<td><?=$q['State'];?></td>
<td><?php echo date('d-m-Y', strtotime($q["JoinDate"]));?></td>
<td><?=$q['MemberApproved'];?></td>
<td><?php echo date('d-m-Y', $q['loginDateTime']);?></td>
</tr>
<?php
}
echo '</table>';
}
?>
Strange still just displays the 2 members...
I'm wondering if this has to do with the category (or member status) not being set in the script. Try my edit in my post above (the part in red at the very top). If that doesn't work, send me a screenshot of what is happening and I'll see what I can do.
Hope this helps.
Well that has fixed that part great! It displays all, but the edit doesn't work or delete...
ok, added another part in red in the above posted code. Hope this helps.