Jump to content

morphboy23

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by morphboy23

  1. Maybe try something like.. <?php include("http://www.domain.com/query.php?query=" . keyword() . ">"); ?>
  2. Ok so I'm setting up a cookie for whenever a user logs into my site. Here's what I have: setcookie('bloowoologinemail', $result['email'], time()+259200, '/', '.bloowoo.com'); Now, I thought that since I have '.bloowoo.com' for the domain, this cookie would be loaded at both http://www.bloowoo.com and http://bloowoo.com yet it's not. How can I fix it so that it's the same cookie for both with and without www?
  3. Ok, so I want to make an RSS feed for my site. Obviously, it should be dynamic, so the only way that comes to mind is to use PHP to create the RSS. But then the filename will be .php. Most of the sites I see with feeds (digg, shoutwire, cnn, etc) have .xml files. How do they do this? I would like to have a .xml that is dynamic/always up-to-date. Thanks for any help
  4. Hm, I figured it out. I had to put the FLOOR statement in its own SELECT. I have no idea why that would fix it, but hey..
  5. Here's what I have: "SELECT (SELECT COUNT(*) FROM inquiries WHERE iduser = '$id') AS icount, (SELECT COUNT(*) FROM responses WHERE iduser = '$id') AS rcount, (SELECT IFNULL( SUM( total_value ) / SUM( total_votes ) , 0 ) / 5 FROM ratings, responses WHERE responses.iduser = '$id' AND responses.idresponse = ratings.id AND ratings.total_votes > 0) AS avgscore, FLOOR(10 * icount + rcount * (20 + 40 * avgscore)) AS score FROM users LIMIT 1" It says it doesn't recognize 'icount,' 'rcount' or 'avgscore' in the FLOOR statement. The reason I'm doing this is because I want all 3 values that make up the score, as well as the score itself, returned.
  6. I know in boolean mode, you can put > and < in front of search terms to increase or decrease the weight of that term in the search result. But is there any way to weigh the term based on what column it was found in? Example: Say I have a table with FULLTEXT(keywords, title, text). Can I have it weigh terms found in 'keywords' more than keywords found in the other two?
  7. For example, if the word "playing" is indexed, then it won't match for "plays" or "play", it seems to have to be exact. Fulltext doesn't do partial word matching? I don't want to have to resort to using LIKE, since I thought it was slower (at least for large tables?). Any help?
  8. So I want to do this: have text with URL tags in brackets (like [ URL]address[ /URL] and turn it into a link I'm using preg_replace('/\[url\](.*)\[\/URL\]/', '<a href="$1" target="_blank">$1</a>', $text); This works fine if there is just 1 link that is in the $text, but if I have 2 like: check [ URL]something.com[ /URL] and also [ URL]somethingelse.com[ /URL] then it matches the very first [ URL] and the very last [ /URL] making the whole line one giant link with a screwed up address is there any way to get it to work how I want it? *note there shouldnt be spaces in the tags, I did that because these forums were actually parsing them
  9. Ok, currently I have this query: "SELECT (SELECT COUNT(*) FROM inquiries WHERE iduser = '$id') AS icount, (SELECT COUNT(*) FROM responses WHERE iduser = '$id') AS rcount, (SELECT IFNULL( SUM( total_value ) / SUM( total_votes ) , 0 ) FROM ratings, responses WHERE responses.iduser = '$id' AND responses.idresponse = ratings.id AND ratings.total_votes > 0) AS avgscore" With 3 rows in 'users', 35 in both 'ratings' and 'responses', and 29 in 'inquiries', this query took about 1/1000th of a second on my machine. These values are used in an equation in php, and must are fetched every time a user's profile page is loaded. With many more rows in these tables, would this query be very slow? I'm wondering whether or not to add a field to one of the tables to hold the calculated score when an inquiry/response row is added, or when a rating row is updated. Or should I just keep things like this? It's the age old storage space & feasibility vs. speed
  10. I'm not familiar with whatever program you are using, but do you have 'title' and 'description' set to Fulltext indexing? I didn't see any mention of that in your table image, though I might have missed it.
  11. Usuall when you modify environment variables, you have to restart your system. Have you tried that? If not, do, then see if it works.
  12. I think this line: mysql_query('UPDATE title SET title = $index_page_title') should be this: mysql_query("UPDATE title SET title = '$index_page_title'")
  13. In the database? Not sure... The 'inquiries' table has about 30-40 test rows with the fulltext index (title, text)
  14. Here is an example of one of my queries: SELECT DISTINCT u.iduser, u.username, i.idinquiry, i.title, i.categories, i.date, i.anonymous, (SELECT COUNT(*) FROM responses AS r WHERE r.idinquiry = i.idinquiry) AS counter, MATCH(i.title, i.text) AGAINST('" . $q . "' IN BOOLEAN MODE) AS score FROM users AS u, inquiries AS i WHERE MATCH(i.title, i.text) AGAINST('" . $q . "' IN BOOLEAN MODE) AND u.iduser = i.iduser ORDER BY score DESC Anyone have any ideas? I'm not sure why the score would be converted to integers, if that is even the case. Any help is appreciated.
  15. I've been checking a lot of examples for utilizing fulltext indexing and how to use MATCH()...AGAINST(), and I noticed that all the relevancy scores returned in these examples are not integers, many times below 1 even. Yet my queries always return whole-number scores, like 1 2 3 etc. Nothing like the .8943246 (whatever) I've seen elsewhere. Am I doing something wrong?
  16. Hm after some tinkering I think I got it.. SELECT questions.idquestion AS id, ( SELECT COUNT( answers.idinquiry ) FROM answer WHERE answer.idquestion = id ) AS counter FROM question GROUP BY question.idquestion ORDER BY counter DESC It works, but seems long..but maybe not? If anyone knows an easier/shorter way, please share!
  17. Hm, it seemed to order the id's correctly, but the COUNT returned the same result for each id..
  18. Okay, so I've been trying for a while to figure this out, and haven't found a solution yet. The example is thus: there is a 'questions' table, with a column 'idquestion' (among others that don't matter right now). there is also an 'answers' table, which also has a 'idquestion' column which refers to the questions table one. multiple rows in 'answers' might refer to the same idquestion. I need to figure out a query that will select every questions.idquestion and the COUNT() of how many rows in 'answers' has that idquestion. So, for example, if 3 answers point to idquestion=1, 2 answers point to idquestion=2, and there are 0 rows that point to idquestions 3 through 10, I want: idquestion / COUNT() 1 / 3 2 / 2 3 / 0 ... / ... 10 / 0 Thanks for any help
×
×
  • 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.