2

I come from a SQL Server background and thought that it might mean it was a temporary table, but after reading up on MySql temp tables I don't think that's true.

I'm seeing it in the following context:

SELECT ID, Name FROM #_SomeName 

UPDATE

This query is defined in a PHP string and then run against the MySQL Database. I'm not sure if that would make a difference or not...

here is the PHP code i'm running:

$query="select id, name from #__SomeName"; $db=&JFactory::getDBO(); $db->setQuery($query); 
2
  • Where did you get this code from? I'm not sure what JFactory is, but could it be that the setQuery method actually modifies the query before sending it to MySQL? Commented Jul 2, 2010 at 17:02
  • It's a project that I'm helping a friend with. Commented Jul 2, 2010 at 17:22

4 Answers 4

5

In MySQL # is an end-of-line comment:

http://dev.mysql.com/doc/refman/5.1/en/comments.html

In JFactory, #__ is used as a place holder. See here:

http://docs.joomla.org/How_to_use_the_database_classes_in_your_script

Sign up to request clarification or add additional context in comments.

1 Comment

Ahh thanks, sorry for the confusion. As you can tell i'm not that familiar with joomla, php, mysql etc.
2

A Comment

# comment -- also a comment 

The syntax highlighting answers the question ;)

Comments

2

are you sure the table name is not quoted using backticks? maybe in the issuing application? it might show up in MySQL's query log bare.

mysql> create table `#t` (i int); mysql> insert into `#t` (i) values (10); mysql> select * from `#t`; +------+ | i | +------+ | 10 | +------+ 

Comments

0

It's usually a comment character. Are there more lines to your script? Basically, I'd expect something like this:

SELECT id, name, whatever FROM #_table my_table WHERE id = 7; 

Maybe someone commented out the old table name and put a new one in?

1 Comment

Hmm very strange. No there are no more lines. So this is actually a string defined in a PHP page that is then run against a MySQL DB, could that make a difference?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.