Reputation: 585
In joomla MVC i came around this SQL query. I was unable to understand the purpose of #sign ??
INSERT INTO `#__helloworld` (`greeting`) VALUES
('Hello World!'),
('Good bye World!');
Upvotes: 3
Views: 572
Reputation: 9918
As you know there is a random 4 or 5 character lentgh table prefix for joomla database tables. This is made for increasing security. Joomla is an opensource content management system, so malicious attackers know what tables exist. You cannot change the table names (or this would takes too long), so adding a prefix for the table names is a nice solution.
#__
part of the table name is replaced with table prefix which has been defined while installing joomla when the code is processed. Also you can see the table prefix in configuration.php or from the administrator panel
Follow Global Configuration -> Server -> Database order.
Upvotes: 2
Reputation: 19
#__ replace with tables prefix (defines in configuration) before execute query
Upvotes: 1
Reputation: 3731
It is replaced by the prefix for that installation when it is run. This way you can have multiple Joomla installations running in the same database, as long as they all have different prefixes. You can find the prefix for your installation in the Global Settings as well as in the configuration.php file.
The entire #__
part is necessary for the replace to work properly. So just a #
will not work as intended.
*Note that this is a Joomla specific construct, so don't expect this to work with just PHP/MySQL. It will work for all Joomla versions and is highly recommended.
Upvotes: 4