Jump to content

pouncer

Members
  • Posts

    324
  • Joined

  • Last visited

    Never

Everything posted by pouncer

  1. This is my functions in my class Lookup function Get_Query_String($string) { $wordArr = str_word_count($string, 1); $ret = ""; foreach ($wordArr as $word) { if (this->Is_Word_In_Search($word) == TRUE) { $ret .= $word; } } return $ret; } function Is_Word_In_Search($word) { $file = "../search_strings.txt"; $fp = fopen($file, "r"); while (!feof($fp)) { $line = fgets($fp, 4096); $line = trim($line); if ($line == $word) { return TRUE; break; } } return FALSE; } then in my collection file i do: $search = new Lookup(); echo $search->Get_Query_String($word); it gives the bool error
  2. when i try to call the function from the same class file lie this if (this->Is_Word_In_Search($word) == TRUE) { $ret .= $word; } i get syntax error, unexpected T_OBJECT_OPERATOR on line 11 line 11 is if (this->Is_Word_In_Search($word) == TRUE) {
  3. function Is_Word_In_Search($word) { $file = "../search_strings.txt"; $fp = fopen($file, "r"); while (!feof($fp)) { $line = fgets($fp, 4096); $line = trim($line); if ($line == $word) { return TRUE; break; } } return FALSE; } is that ok guys, if it finds the word in the file, i want it to return true, otherwise false..
  4. yep, I want to match with for e.g, %cat% OR %dogs% etc. Thanks for confirming the correctness.
  5. can we queries where for LIKE where we can search for 2 strings in the description? like mysql_query("SELECT * FROM collections WHERE description LIKE %something% OR description LIKE %somethingelse%"); is this complettely valid and is my syntax correct guys?
  6. because i send each word to a site to see if its a noun or an adjective
  7. thanks clown. ive got this $string = "My favourite DVD's!"; $un_needed = array("!", "'s", "'"); $string = str_replace($un_needed, "", $string); any other characters you can think to replace with blank?
  8. and also i cant use $string=str_ireplace("'s","",$string); //only works for php 5 because mine isnt php5 any other ways to replace "'s" with "" ?
  9. is there a way i can put all my replace in 1 function like str_replace("'", "", ".", "", ...... etc...)
  10. str_replace for what mate? hmm, im not sure how to do it. can anyone give any sample codes?
  11. Say for e.g, i have a sentence: "Hello, my name is Johnny and I like DVD's" How do I extract each word from the sentence and echo it? and also, i want remove any ' from any words, and also if the word ends in s, i want it to remove the s. so with this sentence it shud echo: Hello my name is Johnny and I like DVD can anyone help me achieve this?
  12. any experts around who can help me with this?
  13. foreach($itemNodes as $item) { $price = $item->getElementsByTagName('CurrentPrice'); echo $price->item(0)->nodeValue . "<br>"; } It echos a list of prices.. fine. But how can i somehow grab the highest/lowest price from it!
  14. can someone please help on the rename part?
  15. thanks. where do i put the file_exists part? and also, if the file does exist how do i rename it the way i put in my 1st post? any help anyone?
  16. I've got this code here which uploads a profile image file.. if (isset($_POST['Submit'])) { $_accepted_extensions = array('.jpg', '.bmp', '.gif', '.JPG', '.BMP', '.GIF'); $tmp = pathinfo($_FILES['imageupload']['name']); if (!in_array('.' . $tmp['extension'], $_accepted_extensions)) { echo "The image you attempted to upload is of the wrong file type."; } else { $target_path = "../profile_images/"; $nm = basename($_FILES['imageupload']['name']); $target_path = $target_path . $nm; if (move_uploaded_file($_FILES['imageupload']['tmp_name'], $target_path)) { echo "The file ". $nm . " has been uploaded to your profile."; $user_id = $_SESSION['UserID']; $Image_URL = "thumbnail.php?im=" . "profile_images/" . $nm; $profile = mysql_query("UPDATE user_profile SET Image_URL = '$Image_URL' WHERE user_id = '$user_id' ") or die (mysql_error()); } else echo "There was an error uploading the image, please try again."; } } I want to change it though to work with: if the file already exists on the ftp, rename the filename (possible adding a random 6 digit number to end of filename?) and upload it. also to store this new filename in the sql table . can anyone help me?
  17. yep, it works perfectly.. thanks! you saved me having creating the other table and stuff!
  18. so say my item_table has 70 items, will that return the latest 9 items? ie. records 61,62,63,64,65,67,68,69,70?
  19. I'm going to create a table in my database called 'latest_items' which should store the latest 9 items (which my users upload etc) but how would i display the latest 9 items. and what if the table already contains 9 records.. and a user uploads a new item, how would i change the table i hope someone can help me out!
  20. they didn't work guys, any ideas peeps?
  21. function get_Keyword() { return $this->row['keyword']; } if the keyword is more then 10, i want it to show the first 10 letter with .. on the end of it, otherwise just to return the whole string? e.g keyword = "mr bean excellent DVD" the function should return: mr bean ex..
  22. Barand, absolutely awesome - that fixed it.
  23. <table width=90% cellpadding=0 cellspacing=10 border=0 align=center><tr><th></th><th></th><th></th></tr><td align=center> <img src="../thumbnail.php?im=collection_items/John_images/godfather1.jpg"> <br> <a href="manageitem.php?item_id=7">Manage</a> <br> <a href="delete_item.php?item_id=7">Delete</a> </td><td align=center> <img src="../thumbnail.php?im=collection_items/John_images/carlitos-way.jpg"> <br> <a href="manageitem.php?item_id=8">Manage</a> <br> <a href="delete_item.php?item_id=8">Delete</a> </td><td align=center> <img src="../thumbnail.php?im=collection_items/John_images/godfather1.jpg"> <br> <a href="manageitem.php?item_id=9">Manage</a> <br> <a href="delete_item.php?item_id=9">Delete</a> </td><tr><td align=center> <img src="../index_images/create_avatar.gif"> <br> <a href="manageitem.php?item_id=12">Manage</a> <br> <a href="delete_item.php?item_id=12">Delete</a> </td></tr><td align=center> <img src="../index_images/create_avatar.gif"> <br> <a href="manageitem.php?item_id=19">Manage</a> <br> <a href="delete_item.php?item_id=19">Delete</a> </td></table> </span></span><br> <span class="style15"> </span><br>
  24. thats inside the loop! if ($i % 4 == 0) echo "<tr>"; echo "<td align=center> <img src=\"$image\"> $i <br> <a href=\"manageitem.php?item_id=$item_id\">Manage</a> <br> <a href=\"delete_item.php?item_id=$item_id\">Delete</a> </td>"; if($i % 4 == 0) echo "</tr>"; i want it to display by a 3 x 3 table.. all items going down the page
×
×
  • 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.