I have a webpage that will display information based on a certain dropdown selection that a user will make. In order to see the data, I have multiple queries that run to determine which data will be displayed. If I am using just 1 query and pdo statement, it is working for me. However, I have multiple queries and pdo statements and when I try to use multiples, I get an Internal Server Error
.
Can anyone offer some advice as to what the problem may be? Here is an example of what one of my queries and PDO statements look like:
$_400p_1_1 = "SELECT CAST([Program_ID] AS INT) AS Program_ID
,CAST([Series] AS INT) AS Series
,[Supplier_Group_Name]
,[Buyer Group Name]
,[Fund Name]
,CAST([Agreement_ID] AS INT) AS Agreement_ID
,[Location Group Name]
,[Product Group Name]
,[Shipping Group Name]
,CAST([Tier_ID] AS INT) AS Tier_ID
,[Retro_to_1]
,CAST([Payments per Year] AS INT) AS [Payments per Year]
,[Condition Unit of Measure]
,CAST([Condition Minimum] AS INT) AS [Condition Minimum]
,CAST([Condition Maximum] AS INT) AS [Condition Maximum]
,CAST([Incentive Multiplier] AS DEC(5,4)) AS [Incentive Multiplier]
FROM [test].[dbo].[vExample]
WHERE [Supplier_Group_Name] = '$supp' AND [Series] = 1 AND [Fund Name] = '400P' AND [Agreement_ID] = 1
ORDER BY [Supplier_Group_Name]";
$stmt = $pdo->prepare($_400p_1_1);
$stmt->execute();
$results1 = $stmt->fetchAll();
And here is an example of bringing in the information to display:
<label>Program ID:</label><input value="<?php echo $results1[0]['Program_ID'];?>" readonly>
I should also mention that the dropdown selection, which is in page1.php
, is sent through AJAX to update.php
where the queries and PDO statements are located, along with the other HTML/PHP code. Again, it works just fine though if I am only using one query and one PDO statement.