Solved

file path from sql query in drupal

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

867 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

16 Experts available now in Live!

Get 1:1 Help Now