Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
18

You can use it, but I would not recommend it especially if you are not familiar with Joomla's codebase and specific PostgreSQL particularities. In the last couple of months I looked into a couple of PostgreSQL issues, as part of my time dedicated to the Joomla Bug Squad. I never used it in production, but here are some issues / what to expect: Supporting ...


17

you need to echo __toString() echo($query->__toString()); you can fing more info here https://docs.joomla.org/API16:JDatabaseQuery/_toString Hope it helps


16

You can get the prefix using the following: For Joomla 2.5 use: $app = JFactory::getApplication(); $prefix = $app->getCfg('dbprefix'); For Joomla 3.2 use: $app = JFactory::getApplication(); $prefix = $app->get('dbprefix'); But Joomla documentation recommends that you never modify the prefix. I know some backup software allows you to make a ...


16

Yes, as far as i'm concerned, the way you built the subquery is the one adopted by the majority of joomla's extensions developers. I use that same method on some of my extensions and custom extensions made for clients. There is no "official" way of doing this, but doing it as you showed lets you use the query builder and still retain a good amount of ...


13

JError has been deprecated in J3.x, in favour of PHP exceptions, as it intermixed 2 different programming concepts: logging and error handling (the logging side has now been implemented as JLog). For your exact case, you can wrap your code in a try / catch block to get the error, as shown in this SO answer: try { ... $db->setQuery($query); $...


10

AFAIK there isn't a built in way to do easy subqueries, which is probably a deficiency in the system and should be corrected via PR. However, I see no issue with your example - seems reasonable enough. ~~~ Here's an example in response to @DavidFritsch's comment below. The more that I think about it though, the better I like the more simple approach ...


9

Ok for starters, you can't use a .html site to display user information, instead you will require a .php file. Once created, you will need to import the Joomla CMS like so: define( '_JEXEC', 1 ); define( 'JPATH_BASE', realpath(dirname(__FILE__).'/' )); require_once ( JPATH_BASE .'/includes/defines.php' ); require_once ( JPATH_BASE .'/includes/framework....


9

The easiest way I've found is to use Akeeba Backup. Very easy to use and free.


9

You can also use Joomla's replacePrefix function which dumps out the query in a format that can be inserted straight into the likes of PhpMyAdmin. Here's an example: $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('something')) ->from($db->quoteName('#__content')); $db->setQuery($query); // ...


8

Storing data for each component in a different database is an extremely bad idea. Yes, it is possible with Joomla, however you should have to hack into a large amount of core files, change database queries and so forth. If you decided to upgrade one of the extensions, it would override all your changes. So this is a no go. Instead, I would suggest running a ...


8

I see in the tags of your question you are using mysql and phpmyadmin, so I assume you are after a a way to INSERT records of users directly into the Joomla database. However please note that, the exact approach should depend on from where you want to import these users and the actual user-data you already have and want to import. Also, if these users ...


7

What I would recommend you do is: Export the database for the Joomla 1.5 site, apart from the #__users table Install a fresh copy of Joomla 1.5 on your localhost Import the database dump you downloaded before You should now have a fresh Joomla 1.5 site with all you content. Install redMIGRATOR which is a Joomla 1.5 extension that will migrate your site to ...


7

You might need to use MySQL to manually repair the table. If you can run arbitrary MySQL on your server, run the mysql CLI and use: REPAIR TABLE jos_users; Alternatively, phpMyAdmin (supplied by many hosts to manage MySQL databases) allows you to repair tables through a GUI. To do so: Access phpMyAdmin and select the Joomla database from the left-hand ...


7

Your foreach will result in situation where $key is array key and $value is one row from database. If you want to get column names from result just use get_object_vars: $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from('#__table'); $db->setQuery($query); $results = $db->loadObjectList(); // this will ...


6

Pretty much the same as @ValentinDespa 's answer but i'm just gonna merge the two things together into something that will work in 2.5 and 3.x. This rather than displaying a full page error message just returns false and then inserts an error message into the top of the page. Hope that's what you're after $db = JFactory::getDbo(); $query = $db->getQuery(...


6

I believe you'll need to use SQL statements such as below. But be CAREFUL - BACKUP THE TABLE FIRST to be sure that you can restore it if there are more considerations than you've realized at this point. This could be combined into a single SQL statement, but for clarity of what you're doing, run each of them UPDATE xxx_menu SET params = REPLACE( ...


5

@Lodder is definitely correct, but there is another syntax for those who are interested. I prefer this syntax because it saves typing the field names as many times $data = new stdClass; $input = JFactory::getApplication()->input; $data->username = $input->get('username'); $data->choice1 = $input->get('choice1'); $data->choice2 = $input->...


5

You will first need to get the values using JInput like so, $input = JFactory::getApplication()->input; $username = $input->get('username'); $choice1 = $input->get('choice1'); $choice2 = $input->get('choice2'); $choice3 = $input->get('choice3'); then for your database query, you can use the following: $db = JFactory::getDbo(); $query = $db-...


5

You can also use native dump() method: echo $query->dump();


5

The data you are looking for is available in same table (#__content) and you will find all the options in attribs column. Note that in MySQL the table will have the db table prefix that you have specified for your database during installation/db creation). And here all the values are storing in the JSON format. { "show_title":"", "...


4

Watch out for exposing too much info! Please note that by throwing SQL errors into the wild, you may expose your database structure or other sensitive information. I would throw SQL errors only in backend (to let's say trusted users) and in frontend just a generic error and I would log the exact error in a error log. Doing a query in 3.x catching and ...


4

If you are accessing the Joomla DB via external scripts, maybe you don't want to initialize all joomla stuffs only to get the database prefix. So, you can require the configuration.php file inside your script, instantiate the JConfig class and get the dbprefix require_once $path_to_joomla_folder . "/configuration.php"; $config = new JConfig; $dbprefix = $...


4

Finally, I've done the export/import via CSV (as I also had to edit all the fulltext entries) and here are the little things that I had to search for: export the Db via CSV, then edit it with Open Office Calc* edit the column so that they match the Joomla3.3 structure. set the column asset_idFK to O, Joomla will assign the correct value when you will open/...


4

This sounds like an error with your database server rather than your website. Are you by any chance using a Hostgator Reseller account? Hostgator is currently experiencing problems with some of their servers, and I think it's been like that all day. Check http://forums.hostgator.com/oct-29-02-00-emergency-maintenance-t328219.html for more information on the ...


4

If you are using having clause without group_by then it will act just like where clause. JDatabaseQuery class provides method for having clause. Try this $query->having('distance <=50');


4

I was very cautious about this question and nearly flagged it as a security hole, but re-read it. You mentioned you have access to the database, so assuming the Super User group ID had not been changed in any way, you can open the #__user_usergroup_map table, find the user_id that corresponds to your user, and change the group_id to 8 which is the default ...


4

If you want to preserve your sanity, don't even try to perform migration manually. I have used Daycounts VM Migrator https://www.daycounts.com/shop/virtuemart-3/virtuemart-2-migrator.htm for migrating five (5) VM1 shops to VM2 in Joomla 2.5, and I have only words of praise for that extension's quality, stability and scalability. It's latest version now ...


4

There are several ways to store data in databases, how you wish to do it depends on your application, it's depth and future growth. I'm no expert in this area, but I do have the experience to know that JSON-storage rarely is efficient, ultimately it strikes back at you. If you only plan on storing this simple data in one simple table, maybe it seems easier ...


4

It's been awhile since I've done this, but as I recall putting this within doExecute should do what you want. $basePath = JPATH_ADMINISTRATOR.'/components/com_content'; require_once $basePath.'/models/article.php'; $artmodel = new ContentModelArticle(array('table_path' => $basePath.'/tables')); $db = JFactory::getDbo(); $q = "SELECT * FROM #__content ...


4

The JDatabaseQuery object has a __toString() function that outputs the query so you can do: echo $db->getQuery(); Or if you want to pass it to a function you can explicitly cast it to a string first: var_dump((string)$db->getQuery());


Only top voted, non community-wiki answers of a minimum length are eligible