View Single Post
Old 26-03-2009, 09:25   #2
punky
Inactive
 
Join Date: Jun 2003
Age: 45
Posts: 14,750
punky has a golden aurapunky has a golden aura
punky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aurapunky has a golden aura
Re: PHP - Trying to retrieve a value from Mysql db

You're missing out a step. Even though you have one row, you still need to fetch the result, not just link to the query. So something like this:

PHP Code:
function get_image($image_id){
    
//finds and displays the selected image 
        
global $connection
        
$query "SELECT     * 
                  FROM tbl_picture_link
                  where picture_link_id = 
{$image_id}  
                  LIMIT 1"
;

        
//get query result 
        
$query_result mysql_query($query$connection);
        
//fetch result as an array
        
$picture_set mysql_fetch_array($query_result);
 
        
confirm_query($picture_set); 
        echo 
"<img scr=\"" $picture_set['picture_link_href'] . "\">" $query."<br />"
    } 
Note as you only have one row returned, you only call the mysql_fetch_array once. If you wanted to do more than one row, you need to do a while loop or something to keep calling mysql_fetch_array and get the new rows.
punky is offline   Reply With Quote