•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,720 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,157 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1585 | Replies: 0
•
•
Join Date: Aug 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi everyone,
I have a SQL statement that runs just fine:
select
distinct(b.swName), a.mwBillToCompanyID, a.mwPaymentTerm, c.swCountry, d.mwCommCode, e.mwGRWarehouse, e.mwDongle,
case when e.mwExportStatus in ('B','C','EL','EUS') then
'End Use Required'
else
'No End Use Required'
end as 'EndUse', dbo.mw_Get_Distrib_Countries(a.mwBillToCompanyID) as 'Countries in Territory',
mwDiscountName, dbo.mw_Get_Distrib_Discounts(a.mwBillToCompanyID) as 'Discount Amounts'
from mw_office_info a
join sw_customer b on a.mwBillToCompanyID = swCustomerID
join sw_address c on b.swCustomerID = c.swObjectID and c.swObjectType = 'CUSTOMER'
join sw_Provider_Grp d on b.mwProviderGrpID = d.swProviderGrpID
join mw_Country e on c.swCountry = e.mwCountry
join sw_territory f on d.swTerritoryID = f.swTerritoryID
join sw_coverage on f.swTerritoryID = sw_coverage.swTerritoryID and f.swActive='1'
join sw_Region r on sw_coverage.swregionID =r.swRegionID
JOIN MW_DISCOUNT_PROGRAMS p on a.mwChannelDiscountID = p.mwDiscountID
JOIN MW_DISCOUNT_XREF dx ON dx.mwDiscountId = p.mwDiscountId
JOIN MW_DISCOUNT_RULES r1 ON dx.mwRuleId = r1.mwruleId
JOIN MW_RULES_XREF rx ON r1.mwRuleId = rx.mwRuleId
JOIN MW_DISCOUNT_CONSTRAINTS c1 ON c1.mwConstraintId = rx.MwConstraintId
where c.swCountry = 'AU'
and mwEffectiveFrom<=getDate() AND mwEffectiveTo>=getDate() AND
mwValue='95' AND mwConstraintName='ProductLineConstraint'
ORDER BY mwDiscountName
As you can see, the last 2 columns are from user-defined functions. For some reason PHP doesn't like the syntax though and it seems to think they are some sort of table. I have tried everything. I created a very simple UDF and tried to get PHP to display the results, and that works just fine. I tried embedding the SQL above into a stored procedure and calling the SP, but it fails. However, like I did with a simple UDF, I created a simple SProc which ran just fine. So for some reason it seems to just not like that SQL I wrote, even though the SQL itself runs just fine in Query Analyzer.
Any ideas how to get PHP to stop trying to do anything to the code and just let SQL handle it entirely? It's like PHP is trying to do some sort of error handling and code validation and it doesn't like that part of the SQL code for some reason.
Thanks!
I have a SQL statement that runs just fine:
select
distinct(b.swName), a.mwBillToCompanyID, a.mwPaymentTerm, c.swCountry, d.mwCommCode, e.mwGRWarehouse, e.mwDongle,
case when e.mwExportStatus in ('B','C','EL','EUS') then
'End Use Required'
else
'No End Use Required'
end as 'EndUse', dbo.mw_Get_Distrib_Countries(a.mwBillToCompanyID) as 'Countries in Territory',
mwDiscountName, dbo.mw_Get_Distrib_Discounts(a.mwBillToCompanyID) as 'Discount Amounts'
from mw_office_info a
join sw_customer b on a.mwBillToCompanyID = swCustomerID
join sw_address c on b.swCustomerID = c.swObjectID and c.swObjectType = 'CUSTOMER'
join sw_Provider_Grp d on b.mwProviderGrpID = d.swProviderGrpID
join mw_Country e on c.swCountry = e.mwCountry
join sw_territory f on d.swTerritoryID = f.swTerritoryID
join sw_coverage on f.swTerritoryID = sw_coverage.swTerritoryID and f.swActive='1'
join sw_Region r on sw_coverage.swregionID =r.swRegionID
JOIN MW_DISCOUNT_PROGRAMS p on a.mwChannelDiscountID = p.mwDiscountID
JOIN MW_DISCOUNT_XREF dx ON dx.mwDiscountId = p.mwDiscountId
JOIN MW_DISCOUNT_RULES r1 ON dx.mwRuleId = r1.mwruleId
JOIN MW_RULES_XREF rx ON r1.mwRuleId = rx.mwRuleId
JOIN MW_DISCOUNT_CONSTRAINTS c1 ON c1.mwConstraintId = rx.MwConstraintId
where c.swCountry = 'AU'
and mwEffectiveFrom<=getDate() AND mwEffectiveTo>=getDate() AND
mwValue='95' AND mwConstraintName='ProductLineConstraint'
ORDER BY mwDiscountName
As you can see, the last 2 columns are from user-defined functions. For some reason PHP doesn't like the syntax though and it seems to think they are some sort of table. I have tried everything. I created a very simple UDF and tried to get PHP to display the results, and that works just fine. I tried embedding the SQL above into a stored procedure and calling the SP, but it fails. However, like I did with a simple UDF, I created a simple SProc which ran just fine. So for some reason it seems to just not like that SQL I wrote, even though the SQL itself runs just fine in Query Analyzer.
Any ideas how to get PHP to stop trying to do anything to the code and just let SQL handle it entirely? It's like PHP is trying to do some sort of error handling and code validation and it doesn't like that part of the SQL code for some reason.
Thanks!
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Database Connection with MY Sql (JSP)
- Very Urgent (Visual Basic 4 / 5 / 6)
- HOWTO: Share an SQL Connection between multiple forms within the same project (C#)
- Problem with OPENXML in UDF (MS SQL)
- SQL Server vs MYSQL vs MSQL (i'm stopping now) (MS SQL)
Other Threads in the PHP Forum
- Previous Thread: paging & _POST variables
- Next Thread: rand number



Threaded Mode