Solved

file path from sql query in drupal

Posted on 2009-07-09
3
488 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Sum of items in two tables not equal. 5 46
T-SQL to copy a database 37 66
sql server cross db update 2 20
Need SSIS project 2 25
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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…
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.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

756 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