"SELECT ph.*, p.price, s.width as widthin, s.height as heightin, m.name as material, d.width as frame_width, d.depth as frame_depth FROM photograph"
Just an example of what I'm looking at, what I don't understand is the prefixed table columns. It must be for other tables in the database as none of these columns are in the table photograph so why have FROM photograph in the query? Also there is more than one table beginning with 's' so how is s.height found when it could be in one of two tables?
Thanks
I have never seen this before.
Moderator: General Moderators
Re: I have never seen this before.
It appears the rest of the query is missing. Those are simply aliases.
That assigns ph as an alias of some_table.
Code: Select all
select ph.* from some_table ph where ph.foo = 'bar'
Re: I have never seen this before.
Code: Select all
"SELECT ph.*, p.price, s.width as widthin, s.height as heightin, m.name as material, d.width as frame_width, d.depth as frame_depth FROM photograph ph, poster_print_prices p, sizes s, frames f, material m, dimensions d WHERE (ph.session_id='$sessionid' or (ph.user_id = '$userid' and ph.user_id > 0)) and ph.order_id='0' and p.id = ph.price_id and m.id = f.material_id and f.dimensions_id = d.id";
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: I have never seen this before.
Look harder:Steji wrote:I can't see where the other aliases are defined like d or s?Code: Select all
"SELECT ph.*, p.price, s.width as widthin, s.height as heightin, m.name as material, d.width as frame_width, d.depth as frame_depth FROM photograph ph, poster_print_prices p, sizes s, frames f, material m, dimensions d WHERE (ph.session_id='$sessionid' or (ph.user_id = '$userid' and ph.user_id > 0)) and ph.order_id='0' and p.id = ph.price_id and m.id = f.material_id and f.dimensions_id = d.id";
FROM photograph ph, poster_print_prices p, sizes s, frames f, material m, dimensions d
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: I have never seen this before.
Thanks, I honestly don't know why I couldn't see that!