Jump to content

Andrew R

Members
  • Posts

    158
  • Joined

  • Last visited

    Never

About Andrew R

  • Birthday 01/03/1989

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Ireland

Andrew R's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Hi there. I was wondering if it were possible to convert text to numbers or some sort of URL friendly link. For example, "Hello there" would be converted to '435342553' or whatever. I want to do this because for example when someone goes to this URL, example.com/435343434, the number/uri string would be decoded and whatever the text was it would be displayed on the site. I can write all this code no bother I just need some advice/ideas on the the encoding/decoding of the text. I was looking at some options for doing this..... hexdec - removes spaces md5 - cannot be decoded? None of them seem to be working, the problem is decoding them. md5 creates a perfect uri string but as I said it cannot be decoded. I would appreciate any ideas of suggestions. Thanks a million.
  2. Thanks a million for that! I guess I could just use str_ireplace but I might have hundreds/thousands of potential words to replace in a string. Which is the most efficient for doing this? Also I might be changing the order of certain words in the string and stuff. As stupid as this sounds I'm building a gangster talk generator for a uni project Thanks a million anyway
  3. Thanks for the reply! I should have said $string is a post eg = $string = $_POST['text']; So for for example a user may enter Hi. They may enter Hello. I want both to change to Welcome basically.
  4. Thanks for your reply. For example if someone enters in Hello. Hi. It will be changed to Welcome.
  5. Hi there I am beginning to learn regex in php. I was wondering why the following regex pattern wasn't finding the two words in the string and replacing them with welcome? '/(Hello).*?(Hi)/is' $patterns = array(); $patterns[0] = '/(Hello).*?(Hi)/is'; $replacements = array(); $replacements[0] = 'Welcome'; ksort($patterns); ksort($replacements); echo preg_replace($patterns, $replacements, $string); Any help would be much appreciated. Thanks a million!
  6. Hi there I have the following array . $products = array( array( Code => "CF1", Items => "Sand Tray", Cat => 'Tray', ), array( Code => "CF2", Items => "Mobile Computer Table", Cat => 'Table', ), array( Code => "CF3", Items => "General Service Trolley", Cat => 'Trolley', ), array( Code => "CF4", Items => "TV Trolley", Cat => 'Trolley', ), array( Code => "CF5", Items => "Overhead Projector Trolley", Cat => 'Trolley', ), array( Code => "CF6", Items => "Book Trolley", Cat => 'Tolley', ), array( Code => "CF7", Items => "Stacking Chairs", Cat => 'Chairs', ), ); What I want to do is select each by 'Cat'. For example I simply want to display all the trolleys. I was wondering how I do this? What functions would I use in PHP? Thanks a million
  7. Positioning an image uploaded inside a image created by the GD library.
  8. Hey Guys Ok I can postion text using the GD library using the following: imagefttext($rImg, 13, 0, 105, 55, $black, $font_file,$Username); How would do the same using an image? For example whateverfunction($rImg, 13, 0, 105, 55,$ImagePath); Thanks a million.
  9. Hi there. How do I stop a function from running it it's taking to long to proccess. For example, say after 10 seconds the code is still working I display an error message? As you can in the following code it's pulling the contents from an url or file which might take too long to load. function Tester($url); { return file_get_contents($url); } Thanks a mil
  10. For example. I have the following: Andrew (Age 19) How would I get the content between the brackets, Age 19 using preg_match_all or a similar function? Thanks very much
  11. Hi Is it possible or is there a function that lists the last three months (based on current month) in an array so I can loop though them? Or would I have to do it the long way aka... $montha = strtotime(date("F 1, Y", strtotime("-1 month"))); $monthb = strtotime(date("F 1, Y", strtotime("-2 month"))); etc etc and then place in an array? Thanks a million
  12. Andrew R

    JOIN Help

    Hi there I have the following two tables: Users(UserID,name); Awards(AwardID,UserID,AwardName); What I'm trying to do is select all the users who haven't got an award yet so I can print them out in a table. I have created the following query with no luck. SELECT * FROM (`Awards`) JOIN `Users` ON `Awards`.`UserID` = `Users`.`UserID` Thanks a million.
  13. Hi there The best way I can explain this is with a diagram. What I'm trying to do is get the footer to stick to the bottom (using sticky footer) but also get the content area to expand depending on the screen size. This would normally be easy enough to do but I have a rounded top on the content area. <div id="wrap"> <div id="rounded-top"></div> <div id="rounded-content"> <div id="main" class="clearfix"> </div> </div> </div> <div id="footer"> <div id=”footer-top”> </div> <div> When I use sticky footer the following is displayed. What I want is the content area to expand. I would appreciate any advice or tips. Thanks a million
  14. The following script checks to see if the user answer matches the correct answer. Form Fields are set up the following way... user_answer[$i] | value = a user_answer[$i] | value = b user_answer[$i] | value = c all radio fields (above) orgid[$i] | value = $i answer[$i] | value = (a or b, c) all hidden fields (above) $i = question id/number Basically when question answer isn't selected an undefined offset error message is generated. Adding if empty or isset messes up the order. foreach ($_POST['orgid'] as $k =>$v) { $orgid[$k] = $v; } $k = 0; $m = 0; while ($k <= 19) { if ($_POST['user_answer'][$k] == $_POST['answer'][$k]) { $correct++; unset ($_POST['user_answer'][$k]); unset ($orgid[$k]); } else { $incorrect++; } $k++; } Any ideas/suggestions? Thanks a million
×
×
  • 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.