Search Results

Search found 2 results on 1 pages for 'keenlearner'.

Page 1/1 | 1 

  • How do I generate a random time interval and add it to a mysql datetime using php?

    - by KeenLearner
    I have many rows in mysql table with datetime's in the format of: 2008-12-08 04:16:51 etc I'd like to generate a random time interval of anywhere between 30 seconds, and 3 days and add them to the time above. a) how do I generate a random time between 30 and 3 days? b) how do I add this time to the date time format above? I imagine i need to do a loop to pull out all the info, do the math in php, and then update the row... Any ideas?

    Read the article

  • Removing the last character of a string IF it is $variable

    - by KeenLearner
    Hi there, I've made a little script to convert titles into url friendly things. ie: 'I am a title' becomes 'I_am_a_title' My script basically goes through and turns spaces, apostrophes, commas etc etc into an underscore. The problem is, sometimes my url's end up like this: 'i_am_a_title_' with a trailing underscore... So i figure, add a little bit to go through and search to see if the last character is an underscore on the final result, and if it is, then swap it. I looked into the strrchr() function but I seem to be hitting a wall of my own understanding. How is this sort of thing accomplished?

    Read the article

1