Jump to content

Maverickb7

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by Maverickb7

  1. [!--quoteo(post=369888:date=Apr 29 2006, 11:30 AM:name=Maverickb7)--][div class=\'quotetop\']QUOTE(Maverickb7 @ Apr 29 2006, 11:30 AM) [snapback]369888[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello-- I have a large database full of articles that I allow my users to search through. I'm curious to see what kinda searches they are making on my site so I was wondering what the best method would be for recording the search terms? I tried something simple with the if/else where it would either add the term to a table or modify the counter if the term exsisted. That didn't really work out as everytime you loaded a new page of results (for the same term) it would keep adding 1+ to the counter. Does anyone have an easy method to get this done? [/quote] I thought this would be pretty simple?
  2. Hello-- I have a large database full of articles that I allow my users to search through. I'm curious to see what kinda searches they are making on my site so I was wondering what the best method would be for recording the search terms? I tried something simple with the if/else where it would either add the term to a table or modify the counter if the term exsisted. That didn't really work out as everytime you loaded a new page of results (for the same term) it would keep adding 1+ to the counter. Does anyone have an easy method to get this done?
  3. Thanks Barand I'll give it a try.
  4. [!--quoteo(post=367718:date=Apr 23 2006, 12:54 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Apr 23 2006, 12:54 PM) [snapback]367718[/snapback][/div][div class=\'quotemain\'][!--quotec--] Well first it gets from the table everyone ordered by their score. Then this line: $num=$_GET['row_number']; Is defining $num as the row number you want (I assumed you do it with a form). And then this part: [code]$i=0; $rows=mysql_num_rows($result); while($i<$rows) { $id=mysql_result($result,$i,"ID"); if($id==$num){ $i=$row; //break while loop echo ($i); } else{$i++}; } }; [/code]Starts a loop- $rows is the number of results you got from the query and i is just 0. It basicly checks every row and row from its ID column value (mysql_result($result,$i,"ID")) and checks if what you asked for is the samw as the ID we got. If it is, it brakes the loop and echos the ID number. Go to www.php.net and search the mysql_result function if you are still not understanding. Orio. [/quote] so how does this do what I asked? I want this to check a certain column in my table tow and tell me what rank it is out of all the rows. Let's say I have 8 members with the following details.... username | posts ------------------------------------ user1 | 10 user2 | 123 user3 | 3423 user4 | 4 user5 | 583 user6 | 69 user7 | 94 user8 | 383 now lets say user8 is logged in... I want it to check the posts column and compare it to all the other users. Then it should output, "You are ranked #6 out of #8". Get what I'm saying?
  5. I have no clue what your code is doing... could you explain it a bit? (Sorry.. still learning and want to know what i'm looking at before putting it to use)
  6. Anyone know of any tuturials that walk you through doing something like this? I wouldn't mind researching it a bit..
  7. [!--quoteo(post=367638:date=Apr 23 2006, 04:13 AM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Apr 23 2006, 04:13 AM) [snapback]367638[/snapback][/div][div class=\'quotemain\'][!--quotec--] Example I have a table of scores with column called score. The 5th highest value in that table is 37581. [code]$scoreval = 37581; $sql = mysql_query("SELECT COUNT(*)+1 FROM scores WHERE score > '$scoreval'"); echo "$scoreval is ranked ". mysql_result ($sql, 0);[/code] [/quote] Alright... that code seems to do what I want but I have a problem. I don't want to manually add the $scoreval as that number is going to increase very often and very fast. I have a row that includes the number of comments a user has posted and when a user is logged in I want it to rank the user x out of all members. I want it to rank the user by the comment count so I do not want to specify the $scoreval as the highest number is going to change constantly.
  8. I have a table full of lots of rows. I want to tell some code to look at one column (which is a number) and then rank it X out of all the rows. So lets say I have 200 rows and I ask it to look at a row that includes the 5th highest number out of all the rows. I want it to output 5. Anyone know how to do this?
  9. [!--quoteo(post=367579:date=Apr 22 2006, 10:11 PM:name=Maverickb7)--][div class=\'quotetop\']QUOTE(Maverickb7 @ Apr 22 2006, 10:11 PM) [snapback]367579[/snapback][/div][div class=\'quotemain\'][!--quotec--] Alright, I'm using the below code. [code]$dh  = opendir("/home/public_html/media/"); while (false !== ($filename = readdir($dh))) {    ${$id}[] = $filename; } sort(${$id}); rsort(${$id}); echo ${$id}[0]; }[/code] I'm using it to generate the filename of the first file within the media folder. Within my media folder is a folder called thumbs and for some reason its listing the folder name rather then the first file. Does anyone know how I can avoid this? [/quote] I've fixed it by adding: [code]if ($filename != "." && $filename != ".." && $filename != "s") { ${$id}[] = $filename; }[/code] works great now!
  10. Alright, I'm using the below code. [code]$dh  = opendir("/home/public_html/media/"); while (false !== ($filename = readdir($dh))) {    ${$id}[] = $filename; } sort(${$id}); rsort(${$id}); echo ${$id}[0]; }[/code] I'm using it to generate the filename of the first file within the media folder. Within my media folder is a folder called thumbs and for some reason its listing the folder name rather then the first file. Does anyone know how I can avoid this?
  11. I think ${$id} is going to work fine.
  12. I want have a variable called $id that includes the ID of my article. I have another variable called $article. What I want to know is how I would include the variable $id at the end of $article. For explain... if the ID equals 33 it would name the variable $article33. How do I use a variable within the name of another variable?
  13. Alright, I've seem to have things working fine but I have one problem. Lets say I have 10 articles displayed on my websites front page. I have one bit of code that is being looped to display each article. Now somewhere along the line the it gets confused and displays info that should be for another article. Now after reviewing the code its safe to say that its because the variables are named the same for all articles causing the code to get confused. What I want to know is how I can make each variable unique? Each article has a unique ID so I was thinking that I could just name the variable whatever and put the ID at the end... but I don't know how to do that. So I guess when it comes down to it what I want to know is how I would give a variable a name... but have that name include a variable? Anyone?
  14. Alright I've been looking for a way to get this done for some time and haven't had any lucky just yet. I post articles to my site every day and when posting a article a specific if I should include one of my image galleries within it. I specify the folder name for the gallery and then use that to list the gallery at the end of the article. Here is where I have a problem. Lets say I have a gallery in the folder "Narnia Screenshots" and within that folder I have another folder called "thumbs". The folder "thumbs" includes the thumbnails of each image. What I want to know is how I would have my code look in X directory and display the filename of the first file within that folder. Anyone know how I would do this? I've been seeing a lot of scandir should that be what I should research?
  15. [a href=\"http://www.bittorrent.com/\" target=\"_blank\"]http://www.bittorrent.com/[/a]
  16. got it to load the page without errors. But theres still a problem. if the string is short it leaves it alone... if its longer it only shows the three dots.. and doesn't show the string?
  17. I used your code in place of mine and got the following error. Parse error: parse error, unexpected T_IF in /home/public_html/functions.php on line 21 I renamed the function and don't know whats causing it. Line 21 is [code]if(strlen($text) <= $len){[/code]
  18. Hello, I'm trying to limit the description of articles on my front page and can't seem to figure out how to do something. If the string is longer then X then it should be cut off and '...' three dots like that should be put at the end. If the string is shorter nothing will be done and no dots will appears. I've got it to got the string if its longer but I have no clue how to make it not do anything and not add the three dots if the string is shorter. Can anyone help? my code is below. [code]function limitWithTags ($text, $length) {         $text = str_replace(array('<BR>', '<br>', '<BR/>', '<br/>', '<BR />', '<br />'), '', $text);         $len = strlen($text);         $count = 0;         $intag = 0;         $inendtag = 0;         $limit = 0;         while ($i < $len) {                switch ($c = $text{$i}) {                case '<':                         $intag = 1;                         $short .= $c;                         if ($text[$i+1]=='/') $inendtag = 1;                         break;                case '>':                         $intag = 0;                         $short .= $c;                         if ($text[$i-1]=='/') $inendtag = 1;                         if ($limit && $inendtag) break 2;                         $inendtag = 0;                         break;                default:                        if (!$intag) {                             if ($count++ < $length)                                 $short .= $c;                             else                                 $limit = 1;                        }                        else                            $short .= $c;                }                ++$i;         }         $short = trim($short, ' ,');  // remove spaces and commas from end         return $short . '...'; }[/code]
  19. does anyone know how I could extract information from a torrent file and display it on a page or save it to a database? I've been looking around for hours and haven't found any information what so ever about this. I would think it would be easier to find considering the popularity of torrent files. :?
  20. hello-- what is better to use and why? Also, I was wondering what would stop someone from sending information to one of my pages use $_GET if they find out the name of my varibles. How can I secure my code?
  21. I was wondering if someone could help me with something. I have a table in my database and within one of the columns is the user id of whom ever created the row. Now what I would like to do is display the top x posters. So I need to somehow count how many times each user id is listed then display the top x users. Does anyone know how I would go about doing this?
  22. Thank you. I have corrected all the errors. :)
  23. hello-- I have some code I would like to debug as its not working. Can someone tell me how I would go about debugging it? I'm trying to add a row into a database and its been working up until a couple hours ago. I'm not sure which changed caused it and I didn't record my changes. I can't figure out where the script is breaking done and could use some pointers on correcting my problem.
  24. Hello-- I have a cms I'm working on and would like to get some help with something. I add/edit/remove articles using PHP and MySQL. I usually use something like: [code]$query = "UPDATE table SET tablecolumn = '$stuff'";[/code] I was wondering how I could confirm that its been successful and display text such as "Update Successful"?
×
×
  • 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.