Solved

file path from sql query in drupal

Posted on 2009-07-09
3
483 Views
Last Modified: 2012-06-27
I'm writing to get the filepath ie "/sites/default/files/myfile.pdf" for my file uploads.

I'm using the below

$row['node_data_field_factsheet_field_factsheet_data']

this returns "a:1:{s:11:"description";s:0:"";}"

How do i get the actual path?

here is my sql statement.
SELECT node.nid AS nid,

   node_data_field_factsheet.field_factsheet_fid AS node_data_field_factsheet_field_factsheet_fid,

   node_data_field_factsheet.field_factsheet_list AS node_data_field_factsheet_field_factsheet_list,

   node_data_field_factsheet.field_factsheet_data AS node_data_field_factsheet_field_factsheet_data,

   node.type AS node_type,

   node.vid AS node_vid

 FROM node node 

 LEFT JOIN content_type_fund node_data_field_factsheet ON node.vid = node_data_field_factsheet.vid

 WHERE node.type in ('fund')

Open in new window

0
Comment
Question by:frosty1
3 Comments
 
LVL 9

Accepted Solution

by:
oliverpolden earned 500 total points
ID: 24819397
This should point you in the right direction.  You can use print_r() to check the returned array, or dpr() with the devel module.

$fid = $row['node_data_field_factsheet_field_factsheet_fid'];

http://drupalcontrib.org/api/function/field_file_load/6/references
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now