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
dfosterf (19-Apr) : The only problem with that is he isn't a guard either.
dfosterf (19-Apr) : Put him at right guard. That is where he will be coached. That is where he will compete. He is not even allowed to look at the LT playbook.
dfosterf (18-Apr) : Kidding aside, I hope the best for him.
dfosterf (18-Apr) : Went to a Titans board. One comment there. Not very long. I quote: "LOL" They don't sound overly upset about our aquisition.
beast (18-Apr) : OT Dillard has been absolutely horrible... like OG Newman levels
dfosterf (18-Apr) : Suit him up and have him stand in front of the big board as a draft day cautionary tale.
Zero2Cool (18-Apr) : Packers sign T Andre Dillard.
Mucky Tundra (18-Apr) : Adds most of the information this time of year comes from agents.
Mucky Tundra (18-Apr) : @RealAlexBarth Bill Belichick says accurate draft information doesn't leak from teams until about 12 hours before the draft. Adds most of th
Mucky Tundra (18-Apr) : I am very happy that for moment, Jordan Love seems like a normal human being
Zero2Cool (17-Apr) : Belichick * whatever
Zero2Cool (17-Apr) : "There's a lot of depth at Offensive Tackle and Wide Receiver." Bill Bellichick
Zero2Cool (17-Apr) : Thanks! I can't believe it's over haha
Martha Careful (16-Apr) : Congratulations
Zero2Cool (16-Apr) : Boom. Student Loan. $0.00. Only took about 20 years.
Zero2Cool (14-Apr) : Packers DT Kenny Clark: New defensive coordinator Jeff Hafley will 'allow us to be way more disruptive'
Zero2Cool (12-Apr) : Saints have agreed to terms on a contract with former Packers wide receiver Equanimeous St. Brown.
beast (12-Apr) : No, but of it's for legislation, then half of the country will find it evil, not good, whatever it says....
Mucky Tundra (12-Apr) : Draft is still 2 weeks away. UGH
dhazer (11-Apr) : Does anyone know of a good AI generator to create letters of Support for legislation?
Zero2Cool (11-Apr) : Gordon "Red" Batty retires as equipment manager
Zero2Cool (10-Apr) : Sounds like that's pretty certain now.
Zero2Cool (10-Apr) : Packers "at" Eagles in Brazil. Week One
dfosterf (10-Apr) : Va' Fazer As Malas Va' !
Zero2Cool (9-Apr) : Mark Murphy tipping us off?
Zero2Cool (9-Apr) : “We’re either the first- or second-most popular team in Brazil.”
Zero2Cool (9-Apr) : Christian Watson got married. Wife better be careful with those hamstrings!! 😂😂
dfosterf (9-Apr) : Those poor bastards
Zero2Cool (8-Apr) : Falcons have signed former Packers CB Kevin King, who has been out of football since 2021.
dfosterf (8-Apr) : Collectively, we need to spend more time in what we have, when analyzing ostendible needs and historical proclivities
dfosterf (8-Apr) : I say he is better than so many of these draft picks
dfosterf (8-Apr) : Question of the week for me: Has anyone besides me done any deep dive into the potential of Alex McGough, our 3rd string qb?
Zero2Cool (8-Apr) : Or in Tunsil's case, something gets released day of draft or day before lol
Zero2Cool (8-Apr) : Seems every year someone does something pre-draft.
dfosterf (8-Apr) : Falling down drunk. The draft board
dfosterf (8-Apr) : Allright! Potential character guy/f#×k up pickup in D'Vondre Sweat!
Zero2Cool (7-Apr) : Go Badgers!!!
Martha Careful (6-Apr) : Go Boilermakers!!!
Martha Careful (5-Apr) : Diggs has not stepped up in the playoffs and has a high cost
beast (5-Apr) : Probably not going to let Diggs walk away unless he's horrible... but according to reports he also might not be as good as he used to be.
beast (5-Apr) : The 25th pick in the draft has been an offensive player since 2017, 2 TE, 2 WR, 1 RB, 1 OC
Mucky Tundra (5-Apr) : Odd, why give up a 2025 2nd Rounder for him if you're just gonna let him walk?
Zero2Cool (4-Apr) : Texans to let Diggs be free agent in '25
buckeyepackfan (4-Apr) : 49r's aign RB Patrick Taylor.
Martha Careful (4-Apr) : Reversion to the mean would indicate we will keep it
Zero2Cool (4-Apr) : It's also been utilized in a trade in 14 of the past 20 years
Zero2Cool (4-Apr) : The 25th pick in the draft hasn't been made by it's original holder since 2016.
Mucky Tundra (4-Apr) : Gotta imagine that Green Bay vs Houston will be a primetime game this upcoming season
Zero2Cool (3-Apr) : No. Kill QB. No worries. 😁
Mucky Tundra (3-Apr) : Diggs, Collins, Dell and Schultz is gonna be tough to cover
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
38m / Green Bay Packers Talk / Martha Careful

19-Apr / Green Bay Packers Talk / dfosterf

19-Apr / Random Babble / Zero2Cool

18-Apr / Green Bay Packers Talk / Zero2Cool

18-Apr / Random Babble / Mucky Tundra

18-Apr / Green Bay Packers Talk / Mucky Tundra

17-Apr / Green Bay Packers Talk / Mucky Tundra

17-Apr / Green Bay Packers Talk / Mucky Tundra

17-Apr / Green Bay Packers Talk / beast

17-Apr / Green Bay Packers Talk / beast

17-Apr / Green Bay Packers Talk / beast

16-Apr / Random Babble / Martha Careful

15-Apr / Green Bay Packers Talk / dfosterf

12-Apr / Random Babble / Nonstopdrivel

12-Apr / Green Bay Packers Talk / Martha Careful

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