Jump to content

Dville

Members
  • Posts

    88
  • Joined

  • Last visited

    Never

Everything posted by Dville

  1. right now it only searches for the 'body' row, i'd like it to search the body and title row, and return the article if either shows a match. i've tried adding it, but due to the php format, and it being chopped up like that, i can't get the syntax correct
  2. I dunno what that means. wouldnt the keyword be 'ubuntu', which i see is in there
  3. the first pasted code is an echo of the bottom query
  4. [code]SELECT * FROM articles WHERE body LIKE '%ubuntu%'[/code] There is another query being ran. But in the code it's chopped up in an odd way i dont understand [code]$query = "SELECT * FROM articles " . "WHERE body LIKE '%".$keywords['0']."%'";[/code]
  5. says [code]SELECT COUNT(id) AS numrows FROM articles WHERE body LIKE '%ubuntu%'[/code]
  6. Not sure what you're asking for, but here is all of my search.php page http://phpfi.com/141089
  7. Awesome, that works out perfectly!
  8. Here is my code [code]// counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $keywords = explode(" ", $search); $query = "SELECT * FROM articles " . "WHERE body LIKE '%".$keywords['0']."%'"; for ($i=1; $i<count($keywords); $i++) { $query = $query." AND body LIKE '%".$keywords[$i]."%'"; } $query = $query." ORDER BY id DESC LIMIT $offset, $rowsPerPage"; $result2 = mysql_query($query) or die(mysql_error()); ?> <form method="GET" action="search.php"> <b>Search:</b> <input type="text" name="search" size="20" /> <input type="submit" value="Search!" /> </form><br><br> <table width="50%" style="border:1px solid #000000;"> <?php $keywords = explode(" ", $search); $query = "SELECT COUNT(id) AS numrows FROM articles " . "WHERE body LIKE '%".$keywords['0']."%'"; for ($i=1; $i<count($keywords); $i++) { $query = $query." AND body LIKE '%".$keywords[$i]."%'"; } $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage);[/code] But I would also like to search both 'body' and 'title'. Due to syntax issues, and not knowing which exact line to edit, I have failed at trying to get it to search both rows. Thanks in advanced to anyone who can help me with this.
  9. So would I update the 'confirm' row in confirm.php, to something like 'confirmed' and in login.php, have it check for confirmed in the  confirm row, and if it is anything other than 'confirmed' then not allow them to login?
  10. new signups, yes. before allowing them to sign into their account
  11. I would like to add email confirmation to my current basic member system. Does anyone know of any articles, that can explain how to add this. Or maybe does anyone know of a simple concept of how this would actually work? I am pretty clueless when it comes to what goes on behind the scenes during an email confirmation. Thanks in advanced.
  12. // This code will remove the '&' chracters to prevent it from breaking the rss feeds $oldWord = "&"; // The new word we want in place of the old one $newWord = "&#38;"; // Run through the text and replaces all occurrences of $oldText $ArticleBody = str_replace($oldWord , $newWord , $ArticleBody); figured it out, rock on
  13. I am looking to take a string stored in $variable, and search it for the & character, and replace it with '&#38;' without the ' ' before placing into the database. I find this character breaks the xml feed, and I'd rather not have to edit the database each and every time. Thanks in advanced to anyone that can help with this trick.
  14. I did figure that out, and now I come across the & issue. I change that to '&#38;' and that fixes that. Wouldnt there be some sort of parser, that will automaticly change these things. Instead of me having to change them from the database.
  15. I have now found how to do this. . .but see a couple issues. 1 - it doesnt update unless I run the file. So the xml file doesn't update unless I personally go to /digg/update_rss.php. How can this be automated. 2 - I get a validation error. [code]1. pubDate must be an RFC-822 date 15 35 2. XML Parsing error: <unknown>:26:20: not well-formed (invalid token) 26 20[/code] when i open the xml file in IE i get [code]Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- Whitespace is not allowed at this location. Error processing resource 'file:///C:/www/digg/rss.xml'. Line 26, Position 21     <title> Search & Share</title> [/code] So yea, if anyone knows of a tutorial, or anything that could assist me in these validation errors I would greatly appreciate it.
  16. So I've been doing this digg clone, and would like to be able to publish RSS feeds. I looked around google and see the template for rss feeds. . .but none are 'automated'. So if someone were to add an article(at http://digg.sytes.net/digg), I would have to update the xml file. How can I make this 'automated/mysql' based? I thought it would be a simple mysql query with a limit of 10 or however many articles i wanted the rss feed to limit to. But I can't find anything that says this. Anyone have a site/tutorial that has a good explaination of how to do this. Thanks in advanced.
  17. Dville

    Base URL

    cool, thanks obs. that wasnt too bad, i was thinking i had to use something like _BASE which i've no exp with. thanks again
  18. I searched both google and here for this, and couldn't find anything. But maybe the standard term for it isn't base url. I have a config.php where i put the mysql database variables, along with the $admin variable, which tells the script what username in the users table has admin rights. What I'm wanting to add to this config.php is a 'base url' variable of sorts, that will hold where the script is running from. So if the user installs it to /digg or /was instead of / the rest of the url/links will be pointing in the right spot. A - how do i setup this variable B - how do i use it in the script for example, if one of my lines look like this [code]<?php echo "/digg/comment.php?appid=$id"; ?>[/code] where in the config, /digg would be the 'base url'. how would i change the link to work(syntax wise) thanks in advanced for anyone who can help me with this
  19. thanks for that debugging tip, i will keep that in mind i guess over time, with having at least more time looking at mysql, it will come together? or is mysql something you have to study real hard? as like a comparison maybe, is mysql harder to pick up than php?
  20. sorry it was the order by votecount, changed it and i think it works well now, time to really test EDIT - sweet, impressive, that works exactly how i am looking for it to work I thought I had to change your count(c.id) to count(c.article.id). but no. it works perfectly if i only knew what it was doing, lol
  21. that does work, when run in phpmyadmin but when i do it through php i get Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\www\digg\include\body.php on line 28 the php code i have is [code=php:0]$result = mysql_query("SELECT a.*, COUNT(c.articleid) AS numcomments, v.numvotes FROM articles AS a LEFT JOIN comments AS c ON a.id=c.articleid INNER JOIN     (     SELECT     a2.id AS articleid, COUNT(v2.id) AS numvotes     FROM articles AS a2     LEFT JOIN     votes AS v2     ON a2.id=v2.articleid     GROUP BY a2.id     ) AS v ON v.articleid=a.id GROUP BY a.id ORDER BY voteCount DESC LIMIT ".$start.", ".$limit); while($row = mysql_fetch_array( $result )) { [/code] then i start echoing my data EDIT - line 28 is the while statement
  22. well. . .now i see it isnt pulling all the rows . . . :( my total articles went from like 60 to 25
  23. i just found an issue. . . so the query i have is [code] SELECT a.*, COUNT(v.id) AS voteCount, COUNT(c.articleid) AS commentsCount FROM articles AS a LEFT JOIN votes AS v ON ( v.articleid = a.id ) LEFT JOIN comments AS c ON ( c.articleid = a.id ) GROUP BY a.id [/code] I 'voted' on one article just now, and instead of it refreshing and going from '0' to '1' it goes straight to 3. I voted again, and it went up to 6. and just did some more test votes. out of about 10 votes, 9 did correct, and changed it from 0 votes to 1. the last one went straight to 4. voted again, and it went up to 8. . .on just two votes when since the article id only shows up twice, it should only show a total of 2 votes wow, i can't believe it, i think i figured it out [code]SELECT a.*, COUNT(v.articleid) AS voteCount, COUNT(c.articleid) AS commentsCount FROM articles AS a LEFT JOIN votes AS v ON ( v.id = a.id ) LEFT JOIN comments AS c ON ( c.id = a.id ) GROUP BY v.articleid[/code]
  24. sweet if($_GET[sort]=='new' ) { function } that worked. but i had to remove the ! before the $. and since im reducing so much other code size, having this one class.pager.php 4 times as big, is not a big deal at allllllll!!!! thanks again redarrow. i added you to the special thanks section as well
×
×
  • 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.