SitePoint Sponsor |
|
User Tag List
Results 1 to 19 of 19
Threaded View
-
Jul 2, 2009, 06:45 #1
- Join Date
- Dec 2006
- Location
- Atlanta, GA
- Posts
- 134
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Converting a query from ColdFusion to PHP
Someone helped me with this query in ColdFusion in the forums a while ago(Thread is here). and I'm now trying to use this query in PHP and I can't seem to get it to work. the tables are exactly the same in the database.
ColdFusion:
Code:<cfquery name="qGetPhoto" datasource="#variables.dsn#"> SELECT p.photo_id , p.photo_file , p.photo_title , p.photo_description , p.photo_keywords , p.photo_date , p.photo_views , a.album_id , a.album_title , ( SELECT MIN(photo_id) FROM tbl_photos WHERE photo_album = p.photo_album AND photo_id > p.photo_id ) AS prev_id , ( SELECT MAX(photo_id) FROM tbl_photos WHERE photo_album = p.photo_album AND photo_id < p.photo_id ) AS next_id FROM tbl_photos AS p INNER JOIN tbl_albums AS a ON p.photo_album = a.album_id WHERE p.photo_id = <cfqueryparam value="#arguments.pid#" cfsqltype="cf_sql_integer" /> </cfquery>
Thanks!
Bookmarks