Zero2Cool
13 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
13 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
13 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
13 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
13 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
13 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
13 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
13 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
13 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
13 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
packerfanoutwest (10h) : having a great long snapper is gold
Zero2Cool (15h) : LaFleur looking like he had some weight. Coachin will do that lol
Zero2Cool (17h) : Thanks Mucky and whomever created topcos for each pick!
Zero2Cool (17h) : Insane about Kingsley
dfosterf (20h) : Putring it here so Mucky sees it. He was our guy!
dfosterf (20h) : Bowden long snapper Wisconsin. Consensus best LS in college.
dfosterf (20h) : We got Peter Bowde
dfosterf (21h) : I personally interpret that as a partial tear that can be recovered from with rehab
dfosterf (21h) : MLF said Kingsley Enagbare did NOT tear his ACL and did NOT require surgery, and that he is "looking good" for the 2024 season!
beast (28-Apr) : T.O. son signs with the 49ers
Mucky Tundra (28-Apr) : damn those vikings
beast (27-Apr) : UDFA Vikings sign TE – Trey Knox, South Carolina
beast (27-Apr) : Kitchen was all high from Miami, he was more lucky than talented in 2022 and it showed in 2023
beast (27-Apr) : Reportedly Packers have UDFAs Jennings and Jones
beast (27-Apr) : OL – Donovan Jennings, USF OT – Trente Jones, Michigan
TheKanataThrilla (27-Apr) : Interesting draft. A bit shocked that we didn't select an early CB. Definitely have Safety help. Pretty happy overall.
dhazer (27-Apr) : wow the last 2 picks are really stupid and probably will be special teams players Top 10 draft pick next year book it
TheKanataThrilla (27-Apr) : I think he ended up with a terrible RAS score
dhazer (27-Apr) : Anyone know what went on with Kitchens from Florida? At 1 point he was to be the Packers 1st round and he is way down the board now
Martha Careful (27-Apr) : Z, could you please combine my thread with yours please. I obviously did not see it when I Created it
Martha Careful (26-Apr) : Re: 'Kool-Aid' McKinstry. Other than Icky Woods, has there ever been a good NFLer with a childish nickname?
Martha Careful (26-Apr) : Packers looking to trade up
Martha Careful (26-Apr) : Flag?
Martha Careful (26-Apr) : Sag?
Nonstopdrivel (26-Apr) : It rhymes with "bag."
beast (26-Apr) : Family? That's Deadpool's F word
Nonstopdrivel (26-Apr) : Not THAT f-word.
Zero2Cool (26-Apr) : fuck
beast (25-Apr) : 49ers are Cap Tight
beast (25-Apr) : Fuck
Mucky Tundra (25-Apr) : Kanata, I will be when I'm on my lunch later
TheKanataThrilla (25-Apr) : Love you NSD
Nonstopdrivel (25-Apr) : Huh. I guess the F-word is censored in this fan shout.
Nonstopdrivel (25-Apr) : Anyone who doesn't hang out in the chat probably smokes pole.
TheKanataThrilla (25-Apr) : GoPackGo Thinking CB is the pick tonight
TheKanataThrilla (25-Apr) : Anyone hanging out in the chat tonight?
Zero2Cool (25-Apr) : whoa...49ers have had trade conversations about both Deebo Samuel and Brandon Aiyuk
Zero2Cool (25-Apr) : I hope they take a Punter at 9th overall. Be bold!
Mucky Tundra (25-Apr) : I may end up eating those words but I think they need a lot more talent then their 4 picks can provide
Mucky Tundra (25-Apr) : I really hope they stand pat and Draft a WR
Mucky Tundra (25-Apr) : @DMRussini
Mucky Tundra (25-Apr) : The Chicago Bears are very open for business at 9 and telling teams they are ready to move for the right price, per source
buckeyepackfan (24-Apr) : Lions extend Penei Soul 4yrs - 112mil
buckeyepackfan (24-Apr) : Lions extend St. Brown 4 years 120mil and
Mucky Tundra (24-Apr) : Now look, trading up to 13 to take a TE might not seem like a good idea later but it will be later!
dfosterf (24-Apr) : (Your trade up mock post)
dfosterf (24-Apr) : Mucky- The only thing fun to watch would be me flipping the f out if Gute goes up to 13 and grabs Brock Bowers, lol
beast (24-Apr) : DT Byron Murphy II, Texas... whom some believe is the next Aaron Donald (or the closest thing to Donald)
Zero2Cool (24-Apr) : What? And who?
Mucky Tundra (24-Apr) : *sad Mucky noises*
Please sign in to use Fan Shout
2023 Packers Schedule
Sunday, Sep 10 @ 3:25 PM
Bears
Sunday, Sep 17 @ 12:00 PM
Falcons
Sunday, Sep 24 @ 12:00 PM
SAINTS
Thursday, Sep 28 @ 7:15 PM
LIONS
Monday, Oct 9 @ 7:15 PM
Raiders
Sunday, Oct 22 @ 3:25 PM
Broncos
Sunday, Oct 29 @ 12:00 PM
VIKINGS
Sunday, Nov 5 @ 12:00 PM
RAMS
Sunday, Nov 12 @ 12:00 PM
Steelers
Sunday, Nov 19 @ 12:00 PM
CHARGERS
Thursday, Nov 23 @ 11:30 AM
Lions
Sunday, Dec 3 @ 7:20 PM
CHIEFS
Monday, Dec 11 @ 7:15 PM
Giants
Sunday, Dec 17 @ 12:00 PM
BUCCANEERS
Sunday, Dec 24 @ 12:00 PM
Panthers
Sunday, Dec 31 @ 7:20 PM
Vikings
Sunday, Jan 7 @ 3:25 PM
BEARS
Sunday, Jan 14 @ 3:30 PM
Cowboys
Saturday, Jan 20 @ 7:15 PM
49ers
Recent Topics
1h / Green Bay Packers Talk / Mucky Tundra

1h / Green Bay Packers Talk / Mucky Tundra

4h / Green Bay Packers Talk / earthquake

7h / Green Bay Packers Talk / Mucky Tundra

14h / Feedback, Suggestions and Issues / Zero2Cool

15h / Green Bay Packers Talk / Mucky Tundra

15h / Green Bay Packers Talk / Martha Careful

15h / Green Bay Packers Talk / Martha Careful

15h / Green Bay Packers Talk / Martha Careful

15h / Green Bay Packers Talk / Martha Careful

15h / Green Bay Packers Talk / Martha Careful

16h / Green Bay Packers Talk / Zero2Cool

16h / Green Bay Packers Talk / greengold

21h / Green Bay Packers Talk / bboystyle

27-Apr / Green Bay Packers Talk / beast

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