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
Zero2Cool (2h) : Former #Packers TE Josiah Deguara is signing a 1-year deal with the Jaguars, per source.
Zero2Cool (3h) : They do not do it for "content sake".
dfosterf (13h) : For the record, I enjoy Beast and Mucky drafts
Zero2Cool (20h) : Haha
Mucky Tundra (21h) : No time for talking! Back to work beast!
beast (21h) : You saw only 4,201 of my mocks? 🥺 I think that means you missed more than half of them 😢
dfosterf (27-Mar) : Does anyone know what Lambeau field improvements got put on hold? My guess would be for the 2025 draft
Zero2Cool (27-Mar) : It's like listen, you made 4,201 mocks, no shit.
Zero2Cool (27-Mar) : Cuz during the draft "I had them mocked there!" as if it's amazing.
Zero2Cool (27-Mar) : They're fun to do once in awhile. It's people who think they are "content" that annoy me.
dfosterf (27-Mar) : Against tbd
dfosterf (27-Mar) : Answer to your question is yes, it's a Thursday, will be the Chiefs aga
dfosterf (27-Mar) : Luckily for all concerned, I don't post them. I did one, but that was like 25 mocks ago
Zero2Cool (27-Mar) : NFL 2024 gonna start Sept 5th isn't it???
Zero2Cool (27-Mar) : Ugh... kids these days!
dfosterf (27-Mar) : I'm gonna go do some more mock draft hell instead 🤪
Zero2Cool (27-Mar) : Did we do one of those prediction threads yet for 2024 season?
dfosterf (27-Mar) : In my city, they are playing the nimby game, in order to keep some railroad tracks vs. 2 professional sports teams and a concert venue.
dfosterf (27-Mar) : And/Or a city council, of which I haven't seen a good one in a very long time
dfosterf (27-Mar) : That sounds like a Mayor, not a city.
buckeyepackfan (26-Mar) : Packers halt scheduled 80mil upgrade of stadium until lease agreement talks are restarted
Zero2Cool (26-Mar) : City of Green Bay puts Packers' Lambeau Field lease talks on hold
buckeyepackfan (26-Mar) : Packers 1 of 3 teams to vote no on new kickoff rule.
Zero2Cool (26-Mar) : Packers sign another Kicker
dfosterf (26-Mar) : Lengthy explanation at PFF if you click the link
dfosterf (26-Mar) : Kickoff rules officially changed.ngthy explan
Zero2Cool (26-Mar) : lol
Cheesey (26-Mar) : 2009? No thanks! One open heart surgery is enough!
dfosterf (26-Mar) : Good for you!
Zero2Cool (26-Mar) : Yes. That's the one.
dfosterf (26-Mar) : Is that "Lady Dugan" per chance?
dfosterf (26-Mar) : Crystal?
dfosterf (26-Mar) : Please refresh my memory
Zero2Cool (26-Mar) : Alan posts. Crystal back in my life. It's 2009 all over again! Lol
Mucky Tundra (26-Mar) : BAH GAWD! THAT'S CHEESEYS MUSIC!
Zero2Cool (25-Mar) : Gutekunst said early stages of Jordan Love contract being discussed.
Zero2Cool (25-Mar) : Shouldn't be penalized cuz official screwed up
Zero2Cool (25-Mar) : Yeah, challenge until you are incorrect twice.
Zero2Cool (25-Mar) : Fining them is the goal, per the people who made the rule anyway.
dfosterf (25-Mar) : Still waiting on the kickoff rule changes. Did hear yesterday that the touchback proposal will now be the 30 yard line, not the 35
dfosterf (25-Mar) : Probably speed of game issues with your proposal
dfosterf (25-Mar) : Hopefully the refs don't get in the habit of throwing flags on this
beast (25-Mar) : I think when it comes to Challenges should get two strikes, so unlimited challenges as long as they keep winning them, but 2 wrong then done
dfosterf (25-Mar) : Still subject to the fines etc
dfosterf (25-Mar) : Yes, I should have been more specific. Also, they are now saying it would be a 15 yard penalty. That makes more sense .
beast (25-Mar) : Simply fined in the week to follow
beast (25-Mar) : I agree with one NFL official, it'll probably be like some of the helmets hits, not really called by the refs on the field but simply fined
Zero2Cool (25-Mar) : Hip drop is not. Super confusing. Referees job is harder
Zero2Cool (25-Mar) : Swivel hip drop is banned
dfosterf (25-Mar) : The hip drop enforcement will be in the form of fines, etc. Not flags
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
13h / Green Bay Packers Talk / dfosterf

13h / Green Bay Packers Talk / bboystyle

13h / Green Bay Packers Talk / bboystyle

20h / Green Bay Packers Talk / Mucky Tundra

27-Mar / Random Babble / Zero2Cool

27-Mar / Green Bay Packers Talk / beast

26-Mar / Green Bay Packers Talk / beast

26-Mar / Green Bay Packers Talk / beast

26-Mar / Green Bay Packers Talk / bboystyle

25-Mar / Green Bay Packers Talk / Zero2Cool

25-Mar / Green Bay Packers Talk / Zero2Cool

24-Mar / Around The NFL / dhazer

24-Mar / Green Bay Packers Talk / beast

24-Mar / Green Bay Packers Talk / beast

22-Mar / Green Bay Packers Talk / beast

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