Zero2Cool
14 years ago
In the posts table, I have 13,155 posts.
The software shows 12,989.

I have 166 posts that were deleted, but not removed from the database??

Edit, actually it means I have 13,155 post ID's, but only 12,989 posts with a text.
UserPostedImage
Zero2Cool
14 years ago
[php]
SELECT _fpro_posts_text.post_id
FROM _fpro_posts, _fpro_posts_text
WHERE _fpro_posts.poster_id='2'
AND _fpro_posts_text.post_id != _fpro_posts.post_id
[/php]

Shouldn't this display a list of posts_text.post_id's that do not have a corresponding posts.posts_id for the poster_id 2?
UserPostedImage
Zero2Cool
14 years ago
This is hopeless. There's a ton of NULL's under id 2, okay, 136 or so, but I can't delete them records!
UserPostedImage
djcubez
14 years ago
From what you say this forum software works like other forum software with a POSTS table, a MEMBERS/USERS table and a TOPICS table. Each of them refer to each other by an auto-incremented value (topicID, postID and memberID). If you want to delete all the posts from members that don't exist you'd have to use multiple queries. For example:


<?php

// establish variables
$memberposts = "0";
$nonmemberposts = "0";

// first query all posts
$post_query ="SELECT * FROM posts";
$post_result = mysql_query($post_query);
while($post_row = mysql_fetch_array($post_result)) {
	// now we can address each post individually
	// we should set some variables we need
	$postID = $post_row["id"];				// The post ID
	$memberID = $post_row["memberid"];		// The member that made this post
	$isMember = true;						// boolean for whether the member exists or not
	// now we need to figure out if the member with that id still exists
	// to do that you need to do a num_rows query
	$member_query = "SELECT * FROM members WHERE id='$memberID'";
	$member_count = mysql_num_rows($member_query);
	// check if it returns a result
	if($member_count < "1") {
		// the member does not exist
		$isMember = false;
	}
	// now we return the result of our script
	if($isMember) {
		// post verified
		$memberposts++;
	} else {
		// delete the post?
		// I wouldn't
		// $delete_query = "DELETE FROM posts WHERE id='$postID'";
		// mysql_query($delete_query);
		$nonmemberposts++;	
	}
}

// display a report at the end
echo "Total posts by members: " . $membersposts . "<br />total posts by non-members: " . $nonmemberposts;

?>

Obviously you'll have to replace the references I make to mysql rows and tables because I don't know whats yours are exactly. But if I do understand what you want this code should work, although I haven't tested it.

EDIT: Please don't run the script with the delete query in it until you've verified that it works. I would not want you to accidentally delete all the posts in this forum because of my bad code. I've already commented the delete query out so that if you want to you can just comment it back in.
Zero2Cool
14 years ago
Yeah, I don't want to delete them just yet. I want to see them first, that's why I was using the SQL query in the phpAdmin.

I can provide the three tables for you guys if that'll help.
UserPostedImage
dhpackr
14 years ago

<?php

// $delete_query = "DELETE ?????FROM posts WHERE id='$postID'";
		// mysql_query($delete_query);
		$nonmemberposts++;	
?>

wouldn't work if it wasn't commented out, this would cause an error, not telling what you want to delete.

why don't you just delete id #2, the whole row? if you are using auto increment for the id field, it wouldn't let you delete the row unless you delete the id
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
14 years ago
I've deleted members in the users table, but not their posts. Therefore there's posts out there that cause errors while searching.
UserPostedImage
dhpackr
14 years ago
imo, the best way to maintain your site would be to manually go into the database through php admin and delete the rows that way.

a script would be nice for maintenance, but you are risking wiping out data you want to keep.

just wondering, did you join the mysql forum. you should, and post questions in the forum.

you'll get your solution...if you are driven.

BTW..I find it humorous, a .NET Developer is running his forum using PHP, Microsoft's main nemesis.

Isn't that like sayin you work at Ford but drive a Toyota?

:icon_smile: just sayin!
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
14 years ago
I was looking into developing my own software using ASP-MVC2 with SQL Server, but it seems like too much work. I'd be reinventing a lot of the options here.

Might as well stick with this and enhance it, instead of recreating everything, right?
UserPostedImage
dhpackr
14 years ago
yes, stick with the PHP site. Classic ASP is an old technology. You have to write a ridiculous amount of "spaghetti" code to do even a simple database call.

Microsoft updated to .NET for a reason!
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Fan Shout
dfosterf (25-Jul) : It's my one day deal complaint dept. on shareholder meeting day
dfosterf (25-Jul) : Probably a homer access credential intimidation kinda thing
dfosterf (25-Jul) : Meathead "journalists" skip this, concentrating on operational revenue when convenient. They switch when net revenue is more favorable.
dfosterf (25-Jul) : Resulting in an actual drop of net revenue of 12.5%. She is from Minnesota. Just sayin'
dfosterf (25-Jul) : Any plans to hold Maureen Smith (CFO) accountable for a 95% drop in investment revenue?
Mucky Tundra (25-Jul) : In your face, HBO!
Mucky Tundra (25-Jul) : @ByRyanWood Mark Murphy: “A great source of pride of mine is that we were never on Hard Knocks.”
Mucky Tundra (25-Jul) : *years
Mucky Tundra (25-Jul) : @mattschneidman Mark Murphy says he anticipates “many Packers games” being played in Germany, Ireland and/or the U.K. over the next 5-10 yea
dfosterf (25-Jul) : *cafeteria* I have hit my head also, so I sympathize
dfosterf (25-Jul) : Possibly hit his head leaning into the glass protecting the food in the cafateria
dfosterf (25-Jul) : Maybe a low flying drone
dfosterf (25-Jul) : Did Savion Williams run into a goalpost or something?
Mucky Tundra (25-Jul) : also, no bueno when a guy starts getting concussions right off the bat in his career
Zero2Cool (25-Jul) : Concussion is worse. Banks probably vet off day via back booboo claim
Mucky Tundra (25-Jul) : @AndyHermanNFL Jordy Nelson out at camp today. No word if he’s in play for one of the two open roster spots ; )
dfosterf (25-Jul) : Is that better or worse than Banks bad back?
Zero2Cool (25-Jul) : Savion concussion ... not good.
packerfanoutwest (24-Jul) : Aaron Rodgers’s first pass of first team period was picked off
Mucky Tundra (24-Jul) : tbh I didn't hear of his passing
Zero2Cool (24-Jul) : Cosby Show. Malcom Jamal Warner I think is real name
Mucky Tundra (24-Jul) : I was thinking of Ozzy and Hulk
Mucky Tundra (24-Jul) : Who's Theo?
Zero2Cool (24-Jul) : How is Theo alliteration?
Mucky Tundra (24-Jul) : Bad week for people whose names are alliterations
Zero2Cool (24-Jul) : Hulk Hogan gone too.
Zero2Cool (24-Jul) : Oh, it's toe injury
Zero2Cool (24-Jul) : Hope it's not serious. that would stink
dfosterf (24-Jul) : Sounds like an ankle not a knee for Fields
dfosterf (24-Jul) : Ya Flaccp on Browns
Zero2Cool (24-Jul) : Maybe Tyrod Taylor instead
Zero2Cool (24-Jul) : He's on Browns, right?
dfosterf (24-Jul) : They would probably go with Flacco is my guess if Fields out
dfosterf (24-Jul) : Fleece 'em again!
Zero2Cool (24-Jul) : Malik Willis might be someone Jets come after
packerfanoutwest (24-Jul) : Packers introduce 1923-inspired classic uniform, leather-look helmet
Zero2Cool (23-Jul) : Both LB Quay Walker and Rookie DB Micah Robinson have passed their physicals
Zero2Cool (23-Jul) : Happy to see site feels more snappy snappy
Zero2Cool (23-Jul) : No sir. I did not.
dfosterf (23-Jul) : You didn't get free childcare when you were at work?
wpr (23-Jul) : These guys make hundreds of thousands of dollars a year. Pay for their own childcare.
dfosterf (23-Jul) : 2nd issue. Number 1 issue was no gameday childcare. 1 of 3 teams not providing it
Zero2Cool (23-Jul) : Suppose if locker room is main issue, we sitting pretty
wpr (23-Jul) : I thought so Mucky. In those useless player polls GB always rates high overall. Locker is a part of it.
Mucky Tundra (23-Jul) : Wasn't the locker room just updated like 6 or 7 years ago?
Zero2Cool (23-Jul) : I have forum updated on different site. We'll see how this one goes before going to that
Zero2Cool (23-Jul) : Elgton Jenkins has a back injury, is expect to end contract dispute
wpr (23-Jul) : It's funny the PA complained about the locker room. It wasn't that long ago it was top shelf. Things change in a hurry.
wpr (23-Jul) : The site is much more better.
Zero2Cool (23-Jul) : NFLPA report said Packers lockerroom needed upgrade. Whining bout where you change?
Please sign in to use Fan Shout
2025 Packers Schedule
Sunday, Sep 7 @ 3:25 PM
LIONS
Thursday, Sep 11 @ 7:15 PM
COMMANDERS
Sunday, Sep 21 @ 12:00 PM
Browns
Sunday, Sep 28 @ 7:20 PM
Cowboys
Sunday, Oct 12 @ 3:25 PM
BENGALS
Sunday, Oct 19 @ 3:25 PM
Cardinals
Sunday, Oct 26 @ 7:20 PM
Steelers
Sunday, Nov 2 @ 12:00 PM
PANTHERS
Monday, Nov 10 @ 7:15 PM
EAGLES
Sunday, Nov 16 @ 12:00 PM
Giants
Sunday, Nov 23 @ 12:00 PM
VIKINGS
Thursday, Nov 27 @ 12:00 PM
Lions
Sunday, Dec 7 @ 12:00 PM
BEARS
Sunday, Dec 14 @ 3:25 PM
Broncos
Friday, Dec 19 @ 11:00 PM
Bears
Friday, Dec 26 @ 11:00 PM
RAVENS
Saturday, Jan 3 @ 11:00 PM
Vikings
Recent Topics
25-Jul / Around The NFL / Mucky Tundra

25-Jul / Green Bay Packers Talk / Mucky Tundra

25-Jul / Green Bay Packers Talk / TheKanataThrilla

25-Jul / Green Bay Packers Talk / dfosterf

25-Jul / Around The NFL / beast

24-Jul / Green Bay Packers Talk / Martha Careful

24-Jul / Around The NFL / beast

24-Jul / Green Bay Packers Talk / Mucky Tundra

23-Jul / Green Bay Packers Talk / beast

23-Jul / Green Bay Packers Talk / wpr

22-Jul / Random Babble / Zero2Cool

22-Jul / Green Bay Packers Talk / Zero2Cool

22-Jul / Green Bay Packers Talk / Zero2Cool

20-Jul / Green Bay Packers Talk / Mucky Tundra

20-Jul / Green Bay Packers Talk / Mucky Tundra

Headlines
Copyright © 2006 - 2025 PackersHome.com™. All Rights Reserved.