I thought that some of you might find it useful to learn how to generate a string with random numbers and letters. I wrote a quick function for generating a string like this. See it below : function genRandomString() { $length = 10; $characters = ‘0123456789abcdefghijklmnopqrstuvwxyz’; $string = ”; for [...]
Continue reading...Saturday, September 29, 2007
Getting a file’s extension is essential when working with uploads and other manipulations complying with files. You might have a user uploading a file and you need to rename the file before moving it from the temporary upload directory. In order to do so, you can obtain the file extension and then rename it to [...]
Continue reading...Thursday, September 20, 2007
With CakePHP, you can remove multiple records from a database table using the deleteAll() model method. deleteAll() Usage $this -> Model -> deleteAll($conditions, $cascade = true); Lets say that you wanted to remove all the records for a specific user from the Item model. Below is a quick example. deleteAll() Example $this -> Item -> deleteAll(array(‘Item.user_id’ => 13)); …where 13 would [...]
Continue reading...
Monday, October 1, 2007
7 Comments