tags:

views:

140

answers:

4

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  A: 

A Comment

# comment
-- also a comment

The syntax highlighting answers the question ;)

Jason McCreary
+5  A: 

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

Mike
Ahh thanks, sorry for the confusion. As you can tell i'm not that familiar with joomla, php, mysql etc.
Abe Miessler
A: 

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?

MBCook
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?
Abe Miessler
+2  A: 

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 | 
+------+
just somebody