Jump to content

itsinmyhead

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by itsinmyhead

  1. Ahh, bummer! I did come across some "random quote generator" RSS feeds that do the same thing - refresh on the PHP page but not once you add them to a homepage like iGoogle. Really kind of a drag...
  2. So, I've got some RSS feeds setup. An example: http://www.adkpennysaver.com/rss/rssfeed.php If you go to that page and refresh, you'll see that the listings are displayed in a random order. However, if you add them to your iGoogle/whatever page, they aren't displayed in a random order - they're displayed in whatever order they were shown on the above page. Even with refreshing your homepage/whatever page the feed is displayed on, the results do not change order. Is there a way to get these to resort randomly each time someone accesses it on their homepage? It's pretty beneficial that the results are displayed in a random order so that all of the ads have a chance to be seen rather than just a few static ones. Thanks!
  3. I can't seem to find a way to get this to work... I either find myself winding up with the same error, or it returns telling me that the result set isn't empty. Did some Googling, of course, but haven't come across a surefire fix.
  4. I've got another question unrelated to the topic, but thought I'd post it here rather than starting a whole new one since people have already been so speed in replying here. Everything is working well, except when there are no ads in a specific category. For instance: http://adkpennysaver.com/rss/rssrea.php (Real Estate - has a decent number of ads to display) http://adkpennysaver.com/rss/rsshelp.php (Help Wanted - no ads to display) If you go to the Help Wanted page, you can see that it just gives an error. Is there any way to get it to display the regular "Subscribe to this feed" page as it does with the Real Estate example linked? I know there aren't any ads listed currently, but I would like people to be able to subscribe to them either way.
  5. Brian, you're awesome! Works like a charm. Thanks so much, everyone! (I would still be interested in knowing how the script in the blog works, Monkeh, if you have any ideas on implementing it into my existing code)
  6. I don't know how I didn't come across his blog when I searched earlier, but oh well. It looks like what I'd need, but I can't figure out how to implement it into my existing code. I tried Brian's suggestion, too, and it displayed zero results. I refreshed a couple of times to make sure and it displayed one letter followed by an ellipsis, but after another refresh it went back to displaying no results.
  7. I made a few searches and couldn't find anything that helped me out. Maybe someone here can lend some advice. I'm creating an RSS feed for our classified ad listings, and I want to limit the description of the results to a certain number of characters - let's say 20. I played around with substr() and other things, but nothing seems to have any affect on the results whatsoever. I don't want any words to be cut in half - I want the last word in a description to be displayed followed by "..." if necessary. Here's what my code looks like right now: <?php $database = "db"; $dbconnect = mysql_connect("localhost","user","pw"); mysql_select_db($database, $dbconnect); $query = "select id, category, description from classifieds order by rand()"; $result = mysql_query($query, $dbconnect); while ($line = mysql_fetch_assoc($result)) { $return[] = $line; } $now = date("D, d M Y H:i:s T"); $output = "<?xml version=\"1.0\"?> <rss version=\"2.0\"> <channel> <title>Adirondack Pennysaver Classified Listings</title> <link>http://www.adkpennysaver.com</link> <description>Classified Ad Listings for the Adirondack Pennysaver in Plattsburgh, New York.</description> <language>en-us</language> <pubDate>$now</pubDate> <lastBuildDate>$now</lastBuildDate> "; foreach ($return as $line) { $output .= "<item><title>".htmlentities($line['category'])." - ".htmlentities(strip_tags($line['description']))."</title> <link>".htmlentities($line['http://www.adkpennysaver.com'])."</link> </item>"; } $output .= "</channel></rss>"; header("Content-Type: application/rss+xml"); echo $output; ?>
  8. I think I'm kind of lost on what you're trying to explain to me here... I don't know what would be submitted as a "crawled keyword." I don't have a string or a list of keywords that are searched - people can search for anything they want. I guess the keyword that would match articles to ads would be the category - Real Estate to Real Estate, Automotive to Automotive, etc.
  9. I think I know what you're saying, but I'm not sure of how to put it into action. The thing is, I can understand how to do this if I were just displaying the information static on the page - find the matches across the two tables and display the results. However, a user can search any number of things and return any number of results in several different categories at a time. So, I'm unsure of how to pull the categories from the results and then match those to the information in my Links table.
  10. I don't remember seeing a suggestion for a UNION, but I did look that up before. I could never get it to work properly - so I was either doing it wrong or it wasn't the method I needed for this particular task. How would I go about that?
  11. Ahh, okay. From the Classifieds table, for instance: ID: 1 Category: Real Estate Description: 1 BR Apartment For Rent... ID: 2 Category: Real Estate Description: Small home for sale... ID: 3 Category: Automotive Description: 1999 Buick... In the Links table: ID: 1 Category: Real Estate Name: #1 Realty Link: http://www.number1.com ID: 2 Category: Automotive Name: Advanced Auto Link: http://www.advancedauto.com Now, as far the Classifieds table goes, I have my search working fine (as seen here: http://www.adkpennysaver.com/search.php). What I would like to do is to have a user run a search. The results will come up, and if the categories from the Classifieds table match a category from the Links table, it will display those results from the Links table (in addition to displaying the results from the search). So, if you searched real estate ads, you would come up with the first 2 results in the Classifieds table, plus the link provided in the Links table. Does that make any sense?
  12. I'm not sure what kind of examples you want, since I haven't found anything that works for me yet. Do you mean examples on other sites? If that's the case, then the easiest example I can think of is Google's ads - where they crawl your page's content and supply related ads. That's in the same realm, basically, of what I'm wanting to do.
  13. I doubt it - you seem to be the only consistent poster replying to these, haha. Let me try to explain again... We have a table for classifieds in our database. You can search the table for any term so you can find ads you want to see. We have a table for links supplied by our advertisers. These can be real estate groups, auto dealers, restaurants, etc. These aren't searchable, they are just for display. What we would like to do is have a user search the ads for an item - i.e., a house. The results will then come back to our user. Then, run another process where the actual results are searched - if there are results in the category "Real Estate" then we would like to display the links from the links table that also fit that category. I know how to call for items from the classifieds & links table that match categories - but I want to crawl the results, not just pull data straight from the tables.
  14. There are a few hundred ads going in each week. Let's say there are 75 real estate ads and the first one is item number 40 in the entire block of ads. If there are only ten links for real estate advertisers in the links table, the IDs (which auto increment) wouldn't match up. And, say they did, I still can't find a way to display matching items based only on search results and not on the entire dataset of the database & tables.
  15. Related like this: "Classifieds" Table: ID Category Description "Links" Table: ID Category Name Address Web The ID numbers aren't linkable, since they auto increment - plus the IDs for classifieds change week to week, for the most part, when the week's new data is imported. Category would match up. However, like I mentioned before, if I just do a join where I select matching categories, it would always display those categories.
  16. Yes, I do - in the "Classifieds" table. What I want to do, though, is to have the data from my "Links" table match and display that. So, if I search for a house for rent and come up with things in "Real Estate", it will display "Real Estate" categorized links. I can do an "if category1 = category2" or "select * where category1 = category2" but these will indefinitely return results whose categories match instead of basing it on the results of the search that has been run.
  17. Just wanted to give this a little bump to see if anyone may have any ideas.
  18. No, I've already got the search results coming up (http://www.adkpennysaver.com/search.php). What I want now is to be able to show related links based on the results of that search.
  19. I'm searching the "classifieds" table. Here's how I do that: $query1 = "select * from classifieds where Category like \"%$trimmed%\" or Description like \"%$trimmed%\" order by Category"; $numresults=mysql_query($query1); $numrows=mysql_num_rows($numresults); So, if I run preg_match to find a match in "query1", it's only going to find a match based on the search term used. This isn't what I want to accomplish. I want the links displayed to relate to the results, not the search term - so if there are results in the Real Estate, Autmotive and Pets categories, it will return the links that correspond to each of those sections.
  20. What tables should I have? Right now, I'm only working with my main classifieds table (which works fine as far as searching/viewing ads goes) and my Real Estate links table. I figure there's not much point in putting all of my links into tables until I can get one working. And right now, I don't have much. I'm at a total loss. I've been playing with strpos and preg_match, but I can't make any real headway with them. What I've been able to accomplish with preg_match is this: - If you click the link for "Real Estate", the Real Estate ads will be displayed as well the Real Estate links. - If you search "real estate", the ads with that term will be displayed as well as the Real Estate links However, I can only get the links displayed with those exact matchings of the term "real estate." If you search for "house" or "rent" or anything that brings up an ad with the category of "Real Estate", I get no results from my links.
  21. So, here's what I'm trying to do. We've got a MySQL database with two tables in it - the first table is 'classifieds' with the fields 'category' and 'description'. The next table is 'links_rea' with the fields 'name', 'address', 'web'. People are able to search our classified ads. What I would like to do, though, is to display related links to their search results. So, if someone searches for "house," I would like to return those search results - plus links that match the category that the ad is placed in (if the ad has a category of "Real Estate," I'd like to return Real Estate ads. If the ad has a category of "Automotive," I'd like to return Automotive ads. etc.) I can't figure out a way to do this. Is there a way that I can crawl the results of my search to find the specific categories, and then return the links that correspond to whatever categories are found? Or something else I should be trying to do, perhaps? Thanks!
  22. Solved. Got some help on another forum. Had to add: $s = $_GET['s']; to the beginning of my code.
  23. Alright, so that problem is gone. Now it's just back to normal - displaying the first ten results of a search while keeping the search term the same (instead of it switching to a number). Still not getting it...
  24. A twist! I've noticed that, on the adkpennysaver.com site, clicking "Next" changes the search term to "10." On the second page, upon clicking "Next," it changes the search term to "20," and so on and so forth. It doesn't do this on the phenixdesigns.net site, despite the code being exactly the same. Does anyone have any tips on this one for me? I am, again, boggled.
  25. Nope... nothing. I'm just totally boggled by this. The same exact code on two different servers, but only one works. Tried your suggestion, too, PF. The search form was given the name "q" which is where the "q" came from in the PHP. I did try changing it, though, and saw no difference.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.