sx Posted April 2, 2007 Share Posted April 2, 2007 Hi again. I have the following statement. $query2 = "SELECT title,tid,start_date,last_post FROM ibf_topics WHERE (forum_id = '$forums') AND (start_date > '$beginstamped') AND (start_date < '$endstamped') ORDER BY start_date DESC"; It works fine. But I want to add another where after the forum_id. I want it to get the rows from ibf_topics where forum id is $forums OR parent_id is $forums, like this. $query2 = "SELECT title,tid,start_date,last_post FROM ibf_topics WHERE (forum_id = '$forums') && (parent_id = '$forums') AND (start_date > '$beginstamped') AND (start_date < '$endstamped') ORDER BY start_date DESC"; But when I make the change I get this error. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wherewes/public_html/backup/linkbot/linkbot.php on line 73 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/wherewes/public_html/backup/linkbot/linkbot.php on line 74 The only thing that changes is the addition of hte parent_id. If I remove it that error goes away. What am I doing wrong?? Quote Link to comment Share on other sites More sharing options...
trq Posted April 2, 2007 Share Posted April 2, 2007 Can you echo $query2 and show us the results? Quote Link to comment Share on other sites More sharing options...
only one Posted April 2, 2007 Share Posted April 2, 2007 try: $query2 = "SELECT title,tid,start_date,last_post FROM ibf_topics WHERE (forum_id = '$forums') AND (parent_id = '$forums') AND (start_date > '$beginstamped') AND (start_date < '$endstamped') ORDER BY start_date DESC"; ?? you dont make much sense Quote Link to comment Share on other sites More sharing options...
only one Posted April 2, 2007 Share Posted April 2, 2007 if that doesnt work just use an if under your select function if(parent_id = $forums){ you knwo your variables better than me :-\ Quote Link to comment Share on other sites More sharing options...
sx Posted April 2, 2007 Author Share Posted April 2, 2007 Ok. here is what this is. This is LinkBOT. This program is for a couple of sites that use Invision Power Boards forums. The user selects a forum and a beginning date and end date. Then hits "go". The script goes into their database and gets the topics that were started within the selected dates. It then goes into the posts table and gets all posts associated with those topics. Then it extracts the links from those posts and checks them to see if they are live links or dead links. LinkBOT supports many file host services. If ALL links within a post are live and supported it will insert a tag within the post that the links were checked by LinkBOT on such and such date ran by such and such user. If dead links are found it inserts a report in the report forum with the problem so that staff can fix it. I already have it fully functional EXCEPT for being able to select parent forums. You must select each individual forum you want checked. If you select a forum and there are subforums in it, LinkBOT will not check the subforums. I am trying to enable the subforums in it. Here is a rundown of the vairables. $forums = The forum ID number of the forum that the staff member wanted to check. $beginstamped = Unix time stamp ( 1 minute after midnight morning of date selected to begin check on. $endstmaped = Unix time stamp (1 minute before midnight night of date selected to end check on. start_date = the Mysql table colum that has teh date the topic was started stored. parent_id = the mysql table column that has the id of the forum that that the current forum is a subforum of. I am wanting the user to select a forum. When LinkBOT checks for topcis within that forum I want it to also get topics that are within forums that are SUBFORUMS (whre the selected forum is in the parent_id column) effectively including any subforums in the check if there are any subforums. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.