Author: Antonie Potgieter

Countries SQL Code

I know that I was looking for the necessary SQL code to create a countries table, together with the necessary queries to insert all the available countries into this table, each with a unique ID key. So I decided to create it and I’m sharing it with the rest of you whom might need it. See the attachment below. Countries SQL...

Read More

CakePHP : Delete multiple records

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 be the ID of the specific user. Off course…you can completely truncate a table with the same method, this time removing all conditions. Below is an example of how to truncate a database table using CakePHP. deleteAll() table truncate $this -> Model ->...

Read More

MySQL : Check if field exists

Sometimes, you need to check if a field exists in a table and if it doesn’t, you need to add it to the table and ensure that its there. Below is a snippet which you can use a reference for checking whether a field/column exists in a MySQL database table. $tableFields = mysql_list_fields("databasename", "tablename"); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $field_array[] = mysql_field_name($fields, $i); } if (!in_array('list_id', $field_array)) { mysql_query("ALTER TABLE `tablename` ADD `fieldname` INT(11) NOT NULL DEFAULT '1';"); } I hope that you find this useful. The code above should give you a good idea of how to do...

Read More

WordPress : Download Older Versions

In case you might need to download an older version of WordPress than the current, latest release, you can go to the release archive and obtain any of the previous releases as needed. And then, you can view all the WordPress release changelogs to see what changes have been made in each version which has been...

Read More

shopping-cartjpg
bundlejpg
questionsjpg
newsletterjpg
banner-rotatorjpg
slideshow-galleryjpg

Stay up to date

Get one email per month with latest news. You can unsubscribe at any time

Fill in a valid email

captcha

shopping-cartjpg
bundlejpg
questionsjpg
newsletterjpg
banner-rotatorjpg
slideshow-galleryjpg

Pin It on Pinterest

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!