ihtus
ihtus

Reputation: 2811

Joomla: JDatabase vs direct SQL manipulation from PHP

Need to do some manipulation to MySQL db in Joomla 2.5.

What are pros and cons for using :

Upvotes: 0

Views: 422

Answers (1)

mavrosxristoforos
mavrosxristoforos

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

Related Questions