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
Zero2Cool (16h) : NFL teams were notified today that the 2025 salary cap has been set at $279,200,000 per club.
Zero2Cool (16h) : sssllllooooow
Martha Careful (16h) : is it just me, or has the website been slow the last couple of days?
buckeyepackfan (26-Feb) : Damnit 2026 2nd rnd pick!
buckeyepackfan (26-Feb) : Packers get Myles Garret and Browns 2926 2nd rnd pick.
buckeyepackfan (26-Feb) : Browns get Jaire, + Packers #1 2025 pick and 2026 3rd rnd pick.
beast (26-Feb) : Rams trying to trade Stafford and Kupp, then signing Rodgers and Adams? Just speculation, but interesting
Zero2Cool (26-Feb) : Packers shopping Jaire Alexander per Ian Rapoport
Zero2Cool (25-Feb) : Gutekunst and Jaire Alexander’s agent, John Thornton, are meeting this week in Indianapolis to determine the future of the Packers’ 28-year-
Zero2Cool (25-Feb) : Gutekunst says Mark Murphy told him he can trade their first-round pick despite the draft being in Green Bay.
Zero2Cool (24-Feb) : Packers. 🤦
Zero2Cool (24-Feb) : One team.
Zero2Cool (24-Feb) : One team petition NFL to ban Brotherly Shove.
beast (23-Feb) : Seems like he was just pissed because he was no longer the starter
beast (23-Feb) : Campbell is right, he's rich and he doesn't have to explain sh!t... but that attitude gives teams reasons to never sign him again.
dfosterf (22-Feb) : I have some doubt about all that
dfosterf (22-Feb) : I read De'Vondre Campbell's tweet this morning (via the New York Post) Florio says that if he invested his earnings wisely, he will be good
beast (20-Feb) : I haven't followed, but I believe he's good when healthy, just hasn't been able to stay healthy.
dfosterf (20-Feb) : Hasn"t Bosa missed more games than he has played in the last 3 years?
Mucky Tundra (19-Feb) : He hasn't been too bad when healthy but I don't feel like I ever heard much about when he is
Zero2Cool (19-Feb) : Felt like he was more interested in his body, than football. He flashed more than I expected
Zero2Cool (19-Feb) : When he was coming out, I thought he'd be flash in pan.
Mucky Tundra (19-Feb) : Joey seems so forgettable compared to his brother for some reason
Zero2Cool (19-Feb) : NFL informed teams today that the 2025 salary cap will be roughly $277.5M-$281.5M
Zero2Cool (19-Feb) : Los Angeles Chargers are likely to release DE Joey Bosa this off-season as a cap casualty, per league source.
Zero2Cool (18-Feb) : If the exploit is not fixed, we'll see tons of "50 top free agents, 50 perfect NFL team fits: We picked where each should sign in March" lo
Zero2Cool (18-Feb) : Issue should be solved, database cleaned and held strong working / meeting. Boom!
Zero2Cool (18-Feb) : It should be halted now.
Mucky Tundra (18-Feb) : usually spambots are trying to get traffic to shady websites filled with spyware; the two links being spammed were to the Packers website
Mucky Tundra (18-Feb) : you know when you put it that way combined with the links it was spamming (to the official Packers website)
Zero2Cool (18-Feb) : Yep. You can do that with holding down ENTER on a command in Console of browser
Mucky Tundra (18-Feb) : even with the rapid fire posts?
Zero2Cool (18-Feb) : I'm not certain it's a bot.
Mucky Tundra (18-Feb) : I've got to go to work soon which is a pity because I'm enthralled by this battle between the bot and Zero
Zero2Cool (18-Feb) : Yeah, I see what that did. Kind of funny.
Mucky Tundra (18-Feb) : now it's a link to Wes Hodkiezwicz mailbag
Mucky Tundra (18-Feb) : Now they're back with another topic
Mucky Tundra (18-Feb) : oh lol
Zero2Cool (18-Feb) : I have a script that purges them now.
Zero2Cool (18-Feb) : 118 Topics with Message.
Mucky Tundra (18-Feb) : what's 118 (besides a number)?
Zero2Cool (18-Feb) : They got 118 slapped in there.
Mucky Tundra (18-Feb) : that's why it confused the hell out of me
Zero2Cool (18-Feb) : Yeah, but this is taking a headline and slapping it into the Packers Talk
Mucky Tundra (18-Feb) : Wasnt there a time guests could post in the help forum?
Zero2Cool (18-Feb) : lol good question, kind of impressed!
Mucky Tundra (18-Feb) : So how is a guest posting?
Mucky Tundra (18-Feb) : Tell them its an emergency
Zero2Cool (18-Feb) : Working. Meetings.
Mucky Tundra (18-Feb) : Lots of fun; the spam goes back 4 or 5 pages by this point
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
13h / Around The NFL / dfosterf

15h / Green Bay Packers Talk / wpr

16h / Green Bay Packers Talk / Zero2Cool

18h / Green Bay Packers Talk / Zero2Cool

27-Feb / Green Bay Packers Talk / wpr

26-Feb / Green Bay Packers Talk / beast

26-Feb / Green Bay Packers Talk / buckeyepackfan

24-Feb / Green Bay Packers Talk / bboystyle

24-Feb / Green Bay Packers Talk / Zero2Cool

23-Feb / Green Bay Packers Talk / beast

19-Feb / Green Bay Packers Talk / Zero2Cool

19-Feb / Green Bay Packers Talk / MintBaconDrivel

18-Feb / Green Bay Packers Talk / Zero2Cool

18-Feb / Green Bay Packers Talk / Zero2Cool

18-Feb / Green Bay Packers Talk / Zero2Cool

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