Re: RE: handling SQL dot notation in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ron,

No database servers I know will return the column name as
<table>.<column>. Only the column name is returned. This has nothing to do
with PHP, but is how the SQL92 standard defines it.

If you want to have nice names you can do something like this:

$query = "SELECT Role.display_Name as my_column_name from Northwind";
..

echo "<td>$row[my_column_name]</td>";

- Frank

> OOPS!...The error comes when trying to display the result in the
> situtation illustrated here:
> 
> echo "<td>$row[frole.display_name]</td>";
> 
> 
> 
> >From: Herhuth, Ron
> >To: php-windows@lists.php.net
> >Sent: 10/10/2003 1:13 PM
> >
> >When using SQL in PHP I have run up against a small issue when working
> >with larger SQL queries...specifically when using alias table names. 
PHP
> >doesn't like the "." used to seperate the table/field name.
> >
> >Here is an example:
> >
> >$query = "SELECT Role.display_Name from Northwind";
> >
> >This generates an error because of the "." symbol in the query.  This
is
> a
> >very rudimentary query used simply for ease of understanding of the
> >problem...but on a larger query where it is necessary to denote
> >field/table relationships using the period becomes crucial.
> >
> >How can I get around PHP's issue with the "."?
> >
> >Thanks,
> >ROn
> >
> >
> >
> >
> >
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux