0

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 

Edited by Dani: Formatting fixed

2
Contributors
4
Replies
23
Views
3 Years
Discussion Span
Last Post by mokshi
0

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

0
$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']);           
                        }                       

Edited by mokshi: Two times typed

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.