Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Is there a way i can amend a field to simply add more data to the end of whats already there d_id corpus 1 (3, 17)|(9, 17) 2 (4, 6) 3 (89, 97) mysql_query("update `dic` set `corpus`='|(2, 12)' where `d_id`='3'"); //amend field with this query so after update row 3 will now be (89, 97)|(2, 12)
  2. exec("gunzip file.gz");
  3. Is it possible to get substr to end on a word boundry instead of halfway through a word? $txt = "The cat goes splat on my bumper mat"; echo substr($txt, 0, 120); //this can be around 12 chars so doesnt need to be exactly 12 chars
  4. Youll be able to set this up in about 15mins http://www.wizecho.com/nav=php&s=php_mysql_boolean Name the project "George Boole" or "Logic Gate" your professor will know what they men
  5. Got it background:#000000 url(/17298356341299066112.jpg) no-repeat left top;
  6. Is it possible to have both background-color and background image. <div align='center' style='border:1px solid #eee;width:850px;height:500px;background-color:#000000;background: url(/17298356341299066112.jpg) no-repeat left top;'>Some white text here</div>
  7. So i have a page cached with php pragma headers. How can i clear the cache when someone sets a cookie: <script> function set_cookie(object, value) { var expireDate = new Date() var expstring = expireDate.setDate(expireDate.getDate() + 500) document.cookie = object+'='+value+'; expires='+expireDate.toGMTString()+'; path=/'; window.location.reload() } </script> <a onclick="set_cookie('list', '1');" href="javascript:void('0');">Set cookie and clear cache</a>
  8. Finally got it to work. Thanks $txt = preg_replace("~<script(.*?)</script>~is", '', $txt);
  9. Whats the best way to remove <script> and <style> tags including the content between them? $txt = "html stuff <script>javascript stuff</script> html stuff <style>.co{color:red}</style>html"; if(preg_match('~<script(.*?)</script>~is', $txt)){ //remove <script> content from $txt }
  10. $productid has no value aka its empty You should use to prevent errors if($productid){ while($row = mysql_fetch_array($productid)) { echo $row['product_id']; //NOW GET AN ERROR Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in XXXXXX/comments.php on line 18 } }else{ echo 'No data'; //remove after testing }
  11. http://www.wizecho.com/nav=php&s=xml Theres a good color coded example halfway down
  12. Under foreach heading: http://www.wizecho.com/nav=php&s=for_loops
  13. Ill just go to the train station at.... http://tinyurl.com/ctteax
  14. dreamwest

    IN()

    Thanks
  15. dreamwest

    IN()

    Is there a way i can set IN() to return rows in order aka from left to right Table: id name 2 amazing 12 video 15 funny example query: SELECT id FROM table WHERE name IN('funny','amazing','video') Which out puts: 2 12 15 What i need the output to be is 15 2 12
  16. This will fix you up http://www.wizecho.com/nav=php&s=email
  17. You need a DREAM baby! The work is nothing if you have a dream to focus on, it can be as simple as a movie night or a new bmw. Theres a good book about this called "the force"
  18. Youll need port 80 for TCP, UDP and HTTP requests. Hostname should be an IP
  19. file_put_contents($file, $current, FILE_APPEND | LOCK_EX);
  20. Im trying to get this imagemagick to work echo shell_exec("/usr/bin/convert -version"); outputs: Version: ImageMagick 6.4.8 2010-09-03 Q16 OpenMP http://www.imagemagick.org Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC This doesnt work (no image is output) What am i missing here? shell_exec("/usr/bin/convert -compress JPEG -quality 100 -sampling-factor 1x1 -enhance a.jpg b.jpg "); echo "<img src='b.jpg'>";
  21. I have a video database that has 500 million rows, and get matches in < 0.0006 secs purely because it inverted. Boolean was slowing down to 2 secs even with full indexing. The reason the inversion works faster is that your only searching the dictionary and already have the count total there, that way you can also avoid counting groups of data which save another second or so. Other than that php can compress your frontend data by up to 70% so a 40KB page will be around 6KB by the time you serve it then you can flush it @ini_set('implicit_flush',1); , this helps with slow user connection speeds and larger docs
  22. Whats the array function to merge two or more similar patterns in a single array. $a = array('red','pink','red','green','blue'); Basically i need to combine "red" so the output will be red, pink, green, blue
  23. OK, because REGEX is doing the actual search i dont need to replace IN() because i can limit the amount to 30 items at a time. Its pretty fast on 50 Million rows it returning a set in 0.0006 secs This is equivilant to "some words" in boolean select id from video WHERE word_id REGEXP '[[:<:]]567,765[[:>:]]' = 1 limit 0, 30 This is equivilant to find rows that contain at least one of the two words in boolean select id from video WHERE word_id REGEXP '[[:<:]](567|765)[[:>:]]' = 1 limit 0, 30 The final one i need is '+some +words' boolean equivilant aka match both numbers within the string, any suggestions?
  24. Problem is the sting is in the database so ive gotta try and get it into a query Something like this checks either number $ids = "(567|7878)"; SELECT `id` FROM `video` WHERE `word_id` REGEXP '[[:<:]]{$ids}[[:>:]]' = 1 The fields look like this id word_id (VARCHAR 255) 1 567,676,7878 2 123,543,34 3 567,75,87 I checked wiki , apparently it can be done http://en.wikipedia.org/wiki/Regular_expression
  25. So i have i simple string of numbers but want to match both numbers, "|" wont work because it matches either number $string = "567 6776 6656 77"; How can i match both number "567" and "77" within the $string?
×
×
  • 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.