Let Joomla and MySQL interact!

I often need a quick and easy few lines to retrieve some data from MySQL using Joomla without all the MVC nonsense that usually goes about this topic. So here is how I do it! [code lang=”php”] $dbSEL = JFactory::getDbo(); $dbSEL->setQuery(“SELECT MAX(`start_price`) FROM #__some_table”); $dbSEL->query(); echo $dbSEL->fetchRow(); [/code] As you Read more…

By Andrew Odendaal, ago

Perform a Mysql Query using Joomla!

This is really actually meant for future reference for myself as lately I’ve been doing quite a lot of Joomla! mysql coding and have used the following code just short of 3million times. $db = JFactory::getDbo(); $querySelectId = "SELECT `id` FROM #__some_table WHERE `user_id`='$user_id'"; $db->setQuery($querySelectId); $db->query(); $data = $db->loadAssoc(); What Read more…

By Andrew Odendaal, ago

Pad a string with zeros using PHP

Recently I had to create a code/username maker to fit into a certain type of pattern so that all “broker codes” (as they were called) followed the same path. An example one looked like so: [code lang=”bash”] HJTH0001 [/code] The number needed to increment and I wanted to use the Read more…

By Andrew Odendaal, ago

How to backup all mysql databases

In order to backup all mysql databases, you can run the following command in your linux command line: The example below is configured with username “theuser” and password “thepass”. [code lang=”bash”] mysqldump -utheuser -pthepass –all-databases > all_dbs.sql [/code]

By Andrew Odendaal, ago