Solved

file path from sql query in drupal

Posted on 2009-07-09
3
485 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Generate Scripts Fails 5 34
Abstract Express Replacement Software 12 23
Sql server function help 15 28
T-SQL Default value in Select? 5 23
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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

805 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