[PHP-DB] mysql_fetch_object

2004-06-28 Thread Bob Lockie
I'm using $row = mysql_fetch_object and I can reference column names by $row-name but how do I reference a pseudo column (that I make, like substring( name from 1 ))? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] mysql_fetch_object

2004-06-28 Thread Larry E . Ullman
I'm using $row = mysql_fetch_object and I can reference column names by $row-name but how do I reference a pseudo column (that I make, like substring( name from 1 ))? Use an alias in your query: SELECT column, DATE_FORMAT('%m', date_column) AS d FROM table ... $row-d Larry -- PHP Database

Re: [PHP-DB] mysql_fetch_object

2004-06-28 Thread Bob Lockie
On 06/28/2004 12:07 PM Larry E.Ullman spoke: I'm using $row = mysql_fetch_object and I can reference column names by $row-name but how do I reference a pseudo column (that I make, like substring( name from 1 ))? Use an alias in your query: SELECT column, DATE_FORMAT('%m', date_column) AS d FROM

Re: [PHP-DB] mysql_fetch_object

2004-06-28 Thread Bob Lockie
On 06/28/2004 12:07 PM Larry E.Ullman spoke: I'm using $row = mysql_fetch_object and I can reference column names by $row-name but how do I reference a pseudo column (that I make, like substring( name from 1 ))? Use an alias in your query: SELECT column, DATE_FORMAT('%m', date_column) AS d FROM

Re: [PHP-DB] mysql_fetch_object

2004-06-28 Thread Hans_L
Bob Lockie wrote: On 06/28/2004 12:07 PM Larry E.Ullman spoke: I'm using $row = mysql_fetch_object and I can reference column names by $row-name but how do I reference a pseudo column (that I make, like substring( name from 1 ))? Use an alias in your query: SELECT column, DATE_FORMAT('%m',

Re: [PHP-DB] mysql_fetch_object

2004-06-28 Thread Bob Lockie
How does it handle fully qualified conflicting columns, like 'select a.name, b.name from a, b'? It won't handle that properly; in your example $row-name would be b.name (it'd overwrite a.name). You have to alias same-named columns. Hans Ok, I don't have that case but I was curious. -- PHP

[PHP-DB] mysql_fetch_object() with MYSQL_NUM or MYSQL_BOTH

2001-08-24 Thread rashkatsa
hello ! mysql_fetch_object() is like mysql_fetch_array() but it returns an object and not an array. so you can access field through this syntax : $obj-fieldname (i.e $obj-amount) you can provide a second parameter to this function : MYSQL_ASSOC, MYSQL_NUM or MYSQL_BOTH. if you use MYSQL_NUM