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
wpr (25m) : I thought KC already won
Zero2Cool (10h) : If you wanna post about the Super Bowl, please, by all means, open a topic. They are free this month! 😁
Zero2Cool (10h) : There doesn't need to be a topic. There's a playoff prediction thread.
packerfanoutwest (10h) : and there no SB contest over in the other Packer forum, either
buckeyepackfan (10h) : #2Officially Retires!
beast (11h) : Probably no SB topic as people are wore out talking about the Chiefs, Refs and Eagles
Zero2Cool (11h) : Packers reportedly have their new LB coach, promoting Sean Duggan to that role
Zero2Cool (15h) : WR Cooper Kupp is being traded.
packerfanoutwest (4-Feb) : why is there no SB Prediction topic?
Zero2Cool (3-Feb) : Anthony Perkins spent 2024 as a defensive quality-control coach with the Packers.
Zero2Cool (3-Feb) : Packers lose another assistant.
Zero2Cool (3-Feb) : Defensive Player of the Year and Browns star Myles Garrett has requested a trade.
Zero2Cool (3-Feb) : deleted all my browser history and autofill and passwords. gonna be fun!
packerfanoutwest (3-Feb) : too funny
packerfanoutwest (3-Feb) : Lions QB Jared Goff was the offensive MVP
packerfanoutwest (3-Feb) : for the Pro Bowl, which is flag football
Zero2Cool (2-Feb) : Rather, the murder WAS covered up to prevent ...
Zero2Cool (2-Feb) : JFK murder was a cover-up to prevent war with Cuba/Russia.
Martha Careful (1-Feb) : I have always admired the pluck of the man
Zero2Cool (1-Feb) : I remember thinking he was going to be something good.
Mucky Tundra (1-Feb) : The Dualing Banjo!
Zero2Cool (31-Jan) : Jets have named Chris Banjo as their special teams coordinator, Former Packers player
Zero2Cool (31-Jan) : Jaguars have hired Anthony Campanile as their DC. We lose coach
Zero2Cool (30-Jan) : QB coach Sean Mannion
Zero2Cool (30-Jan) : DL Coach DeMarcus Covington
dfosterf (30-Jan) : from ft Belvoir, Quantico and points south. Somber reminder of this tragedy at Reagan Nat Airport
dfosterf (30-Jan) : So eerily quiet here in Alexandria. I live in the flight path of commercial craft coming from the south and west, plus the military craft
dfosterf (30-Jan) : So eeri
Mucky Tundra (30-Jan) : Now that's a thought, maybe they're looking at the college ranks? Maybe not head coaches but DC/assistant DCs with league experience?
beast (30-Jan) : College Coaches wouldn't want that publicly, as it would hurt recruiting and they might not get the job.
beast (30-Jan) : I thought they were supposed to publicly announce them, at least the NFL ones. Hafley was from college, so I believe different rules.
Mucky Tundra (30-Jan) : Who knows who they're interviewing? I mean, nobody knew about Hafley and then out of nowhere he was hired
beast (30-Jan) : I wonder what's taking so long with hiring a DL coach, 2 of the 3 known to interview have already been hired elsewhere.
Zero2Cool (27-Jan) : Packers coach Matt LaFleur hires Luke Getsy as senior assistant, extends Rich Bisaccia's deal
Zero2Cool (27-Jan) : Chiefs again huh? I guess another Super Bowl I'll be finding something else to do.
Mucky Tundra (27-Jan) : Chiefs Eagles...again...sigh
dfosterf (27-Jan) : Happy Birthday Dave!
Mucky Tundra (27-Jan) : happy birthday dhazer
TheKanataThrilla (26-Jan) : Exactly buck...Washington came up with the ball. It is just a shitty coincidence one week later
buckeyepackfan (26-Jan) : I forgot, they corrected the call a week later. Lol btw HAPPY BIRTHDAY dhazer!
buckeyepackfan (26-Jan) : That brings up the question, why wasn't Nixon down by contact? I think that was the point Kanata was making.
buckeyepackfan (26-Jan) : Turnovers rule, win the turnover battle, win the game.
packerfanoutwest (26-Jan) : well, he was
TheKanataThrilla (26-Jan) : Eagles down by contact on the fumble....fuck you NFL
Mucky Tundra (26-Jan) : I think this games over
beast (26-Jan) : Eagles sure get a lot of fumbles on kickoffs
Mucky Tundra (26-Jan) : This game looks too big for Washington
packerfanoutwest (26-Jan) : that being said, The Ravens are the Browns
packerfanoutwest (26-Jan) : Browns, Dolphins have longest AFC Championship droughts
packerfanoutwest (26-Jan) : As of today, Cowboys have longest NFC Championship drought,
Please sign in to use Fan Shout
2024 Packers Schedule
Friday, Sep 6 @ 7:15 PM
Eagles
Sunday, Sep 15 @ 12:00 PM
COLTS
Sunday, Sep 22 @ 12:00 PM
Titans
Sunday, Sep 29 @ 12:00 PM
VIKINGS
Sunday, Oct 6 @ 3:25 PM
Rams
Sunday, Oct 13 @ 12:00 PM
CARDINALS
Sunday, Oct 20 @ 12:00 PM
TEXANS
Sunday, Oct 27 @ 12:00 PM
Jaguars
Sunday, Nov 3 @ 3:25 PM
LIONS
Sunday, Nov 17 @ 12:00 PM
Bears
Sunday, Nov 24 @ 3:25 PM
49ERS
Thursday, Nov 28 @ 7:20 PM
DOLPHINS
Thursday, Dec 5 @ 7:15 PM
Lions
Sunday, Dec 15 @ 7:20 PM
Seahawks
Monday, Dec 23 @ 7:15 PM
SAINTS
Sunday, Dec 29 @ 3:25 PM
Vikings
Sunday, Jan 5 @ 12:00 PM
BEARS
Sunday, Jan 12 @ 3:30 PM
Eagles
Recent Topics
4h / Green Bay Packers Talk / wpr

11h / Green Bay Packers Talk / Martha Careful

13h / Green Bay Packers Talk / beast

13h / Green Bay Packers Talk / Zero2Cool

4-Feb / Green Bay Packers Talk / earthquake

4-Feb / Green Bay Packers Talk / earthquake

1-Feb / Green Bay Packers Talk / Martha Careful

1-Feb / Green Bay Packers Talk / wpr

29-Jan / Green Bay Packers Talk / Mucky Tundra

27-Jan / Green Bay Packers Talk / beast

25-Jan / Green Bay Packers Talk / beast

25-Jan / Green Bay Packers Talk / Martha Careful

25-Jan / Random Babble / Martha Careful

20-Jan / Green Bay Packers Talk / Martha Careful

20-Jan / Green Bay Packers Talk / bboystyle

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