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
Mucky Tundra (4h) : Whoops, I thought Zero was saying it was a surprise the Brewers lost and not Lloyd being hurt
Mucky Tundra (4h) : Not a surprise; inevitable
Zero2Cool (6h) : Brewers streak ends at 14
Zero2Cool (7h) : SURPRISE
Mucky Tundra (8h) : @mattschneidman Matt LaFleur on MarShawn Lloyd: “He’s gonna miss some time.”
Mucky Tundra (16-Aug) : CLIFFORD WITH THE TD WITH UNDER 2 TO GO!!!!!
Zero2Cool (16-Aug) : 90 MINUTES UNTIL FAKE KICKOFF!!
Martha Careful (16-Aug) : I think Ruven is a bot, but regardless should be stricken from the site.
Zero2Cool (14-Aug) : Packers RB Josh Jacobs ranked No. 33 in NFL 'Top 100'
dfosterf (13-Aug) : The LVN Musgrave collision- Andy Herman said Musgrave seemed to be the one most impacted injury-wise
dfosterf (13-Aug) : a lower back injury
dfosterf (13-Aug) : Doubs says he's "fine" after injury scare. Some reported it as z
Mucky Tundra (13-Aug) : With LVN that is; need to see what happens in the next practice
Mucky Tundra (13-Aug) : beast, reading about what happened, it sounded like one of those "two guys collide and are moving slow afterwards" type of deals
beast (12-Aug) : I believe Musgrave has been injured every single season since at least a Sophomore in highschool
packerfanoutwest (12-Aug) : Matt LaFleur: “Highly unlikely” Jordan Love plays more this preseason
dfosterf (12-Aug) : Doubs, Savion Williams, LVN, Musgrave all banged up to one degree or another, missing one here I forget
Zero2Cool (12-Aug) : RB Tyrion Davis-Price is signing with the Green Bay Packers.
Zero2Cool (12-Aug) : zero help, dominated. preseason
beast (12-Aug) : QB Jordan Love has surgery
beast (12-Aug) : Martha said Morgan had a lot of help, I didn't watch the OL so I can't say.
Zero2Cool (10-Aug) : Packers LT Jordan Morgan did not allow a single pressure across 23 pass-blocking snaps vs. Jets last night, per PFF
Mucky Tundra (10-Aug) : With buckeye and the reasonable couple, we're currently sitting at 10
buckeyepackfan (10-Aug) : Just posted to re-up on our FFL.
Zero2Cool (10-Aug) : If healthy after, then thats all I care. Well, no drops would be nice
wpr (10-Aug) : I made it through the 1st Q.
dfosterf (10-Aug) : Just gotta figure out how.
dfosterf (10-Aug) : Could have been a worse start, so there is that.
beast (10-Aug) : Yeah, someone tell the Packers football season has started, seems like they weren't ready for it
Mucky Tundra (10-Aug) : Sooooooo many penalties
Mucky Tundra (10-Aug) : It may only be preseason, but this game is a trip to the dentist
Zero2Cool (10-Aug) : Packers do bad -- FREAK OUT!!!!!!
Zero2Cool (10-Aug) : Packers do good -- eh only preseason
dfosterf (10-Aug) : Well that half was fun
Zero2Cool (10-Aug) : Great, zayne is down
Zero2Cool (9-Aug) : 13 minutes away from kickkkkkkkkkkkkkkkkoffff
Zero2Cool (9-Aug) : Had Celebration of Life for my uncle up north. wicked rain hope it dont come south
Mucky Tundra (9-Aug) : THE GREEN BAY PACKERS ARE PLAYING FOOTBALL TONIGHT!!!!!! THIS IS NOT A DRILL!!!!
Zero2Cool (9-Aug) : Woo-hoo
TheKanataThrilla (9-Aug) : NFL Network is broadcasting the game tonight, but not in Canada. Not sure why as no local television is showing the game.
beast (8-Aug) : But the Return from IR designations had to be applied by the 53 man cutdown.
beast (8-Aug) : It's a new rule, so it's not clear, but my understanding was that they could be IR'd at any time
Mucky Tundra (8-Aug) : *had to be IRed at 53
Mucky Tundra (8-Aug) : beast, I thought the designate return from IR players had to be IR at cutdowns to 53, not before
beast (8-Aug) : It's a brand new rule, either last season or this season, prior, all pre-season IRs were done for the season
beast (8-Aug) : But the Packers would have to use one for their return from IR spots on him, when they cut down to 53.
beast (8-Aug) : I think the NFL recently changed the IR rules, so maybe the season might not be over for OL Glover.
Zero2Cool (8-Aug) : Packers star Howton, first NFLPA prez, dies at 95 😔
dfosterf (8-Aug) : Apparently it is too complicated for several to follow your simple instructions, but I digress
dfosterf (8-Aug) : Zero- Did you see what I posted about Voice of Reason and his wife? She posted over at fleaflicker that they are both "In"
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
13m / Green Bay Packers Talk / Mucky Tundra

22h / Fantasy Sports Talk / GoPack1984

23h / Green Bay Packers Talk / beast

17-Aug / Green Bay Packers Talk / Mucky Tundra

16-Aug / Feedback, Suggestions and Issues / beast

15-Aug / Around The NFL / Mucky Tundra

13-Aug / Green Bay Packers Talk / dfosterf

12-Aug / Green Bay Packers Talk / Zero2Cool

12-Aug / Green Bay Packers Talk / beast

12-Aug / Green Bay Packers Talk / beast

12-Aug / Green Bay Packers Talk / beast

12-Aug / Random Babble / Zero2Cool

11-Aug / Green Bay Packers Talk / bboystyle

11-Aug / Around The NFL / Martha Careful

11-Aug / Around The NFL / packerfanoutwest

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