Reputation: 2811
Need to do some manipulation to MySQL db in Joomla 2.5.
What are pros and cons for using :
JDatabase or
direct SQL manipulation from PHP (with php functions: mysql_connect, mysql_select_db, mysql_query, mysql_fetch_row)
Upvotes: 0
Views: 422
Reputation: 3643
Using the JDatabase is the hands down winner, since you have to find the prefix of all the tables somehow.
With JDatabase, you use #__
to automatically access the prefix of this Joomla installation. (Remember that you may have various Joomla installations on one database).
You would have to do various work-arounds to find that in other ways, or you would have to create tables without a prefix which is also a bad idea with Joomla code.
I disagree with wiscWeb. This is not a matter of different opinions. All extensions I have ever seen to the moment, use the JDatabase class or extend that class for their own functions. (and I have seen hundreds of extensions)
Upvotes: 4