Page 1 of 1

Displaying content of SQL column

Posted: Wed Mar 16, 2005 11:10 am
by snicolas
Hi all,

I am encountering a small problem and wondering if this is normal or i am missing something.

I have a SQL db and run PHP 4.3
One of my Column name is quite Long, like "NumberOfLocationInTheBuilding"

If i try to echo this as echo &obj->NumberOfLocationInTheBuilding; nothing is displayed on my page.
But when I insert or update data via a php form, everyhting is loaded correctly in db.

So my question is:
Does echo have some restriction in the lenght of column name?

s

Posted: Wed Mar 16, 2005 11:23 am
by feyd
echo doesn't care how long the variable name is, nor does the computer. Post your code though.. &obj isn't valid code.

Posted: Wed Mar 16, 2005 11:29 am
by snicolas
hey F

My code is simple
$obj_query = $sql->query("Select * from table where id='1'");
$obj= $sql->objects('',$obj_query);

From there I echo most of my table as:
exho $obj->name;
etc

most of column work apart from 3 column that are really long
their name are
NumberOfLocationInTheBuilding1
NumberOfLocationInTheBuilding2
NumberOfLocationInTheBuilding3

I quadruple checked the name and they are correct!

s

Posted: Wed Mar 16, 2005 11:36 am
by feyd
check what gets output by var_export() and/or print_r() against $obj ...

Posted: Wed Mar 16, 2005 11:42 am
by snicolas
Reducing the name of column "fixed" the problem...
Strange still, didn't know that a long column name could affect the display of results?

s

Posted: Wed Mar 16, 2005 12:03 pm
by feyd
it may only affect objects created by your functions.. using array's may be a better option.