Hi i need to use the below query in PHP to generate PDF but its not displaying what are all the supporting files i need to put for running the below (XML path) query in php,Its running successful in sql but when i put in php its not working can any one help in this its very urgent

select a.projecttype  as Projecttype,a.projecttitle,a.applicationtype,a.projectvalue,
CONVERT(VARCHAR(11),a.startdate,106) as startdate,
CONVERT(VARCHAR(11),a.closuredate,106) as closuredate,
STUFF((select ';' + b.coinvestigatorname  
from iitmicsr..projectdetails a left outer join 
iitmicsr..coinvestigatordetails b on a.projectnumber = b.projectnumber 
where  a.EmployeeId = '008074'and a.projecttype in( 'C','S')
FOR XML PATH('')), 1, 1, '') as coinvestigatorname
 group by a.projecttype,a.startdate 

Recommended Answers

All 4 Replies

Above was the query i have tried,query working in sql server but When i put the query in php and run the code i am getting file not supported error tell me some other solution to combine multiple rows

$query = mssql_query("select a.projecttype as Projecttype,a.projecttitle as projecttitle,a.projectvalue as projectvalue,
CONVERT(VARCHAR(11),a.startdate,106) as startdate,
CONVERT(VARCHAR(11),a.closuredate,106) as closuredate,
STUFF(( select cast (',' + b.coinvestigatorname + ' ' + b.departmentcode as TEXT) from iitmicsr..coinvestigatordetails b 
where a.projectnumber = b.projectnumber FOR XML PATH('')), 1, 1, '') as coinvestigatorname
from iitmicsr..projectdetails a where a.EmployeeId='$facname' and a.projecttype in( 'C','S') 
order by a.Projecttype,a.StartDate desc"); 


while($cr=mssql_fetch_assoc($query))
                        {
                            $data3[] = array($cr['Projecttype'],$cr['projecttitle'], $cr['projectvalue'], $cr['startdate'],$cr['closuredate'],$cr['coinvestigatorname']);           
                        }                       
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.