Greywacke Posted May 13, 2010 Share Posted May 13, 2010 hi again, struggling a bit to wrap my head around this one - the following function was created: function getrecords() { $sql = "SELECT 14_pricecategories.bigint_CategoryID, 14_pricecategories.text_CategoryDescription, 14_pricecategories.bigint_CategoryPrice, 2_servicescatalogue.bigint_ServiceID, 2_servicescatalogue.text_ServiceDescription FROM 14_pricecategories LEFT JOIN ( 2_servicescatalogue ) ON ( 14_pricecategories.bigint_ServiceID = 2_servicescatalogue.bigint_ServiceID ) ORDER BY 14_pricecategories.text_CategoryDescription ASC;"; $result = mysql_query_errors($sql , $conn , __FILE__ , __LINE__ , false); if ($result) { while ($row = mysql_fetch_array($result)) { echo " <pricecat>\n"; echo " <catid>".$row["bigint_CategoryID"]."</catid>\n"; echo " <svcid>".$row["bigint_ServiceID"]."</svcid>\n"; echo " <catdesc>". xmlentities($row["text_CategoryDescription"])."</catdesc>\n"; echo " <catprice>".$row["bigint_CategoryPrice"]. "</catprice>\n"; $sql0 = "SELECT 16_attributegroupings.bigint_ServiceID, 16_attributegroupings.bigint_CategoryID, 16_attributegroupings.bigint_GroupID, 3_serviceattributes.bigint_AttributeID, 3_serviceattributes.text_AttributeDescription FROM 16_attributegroupings LEFT JOIN ( 3_serviceattributes ) ON ( 16_attributegroupings.bigint_AttributeKeyID = 3_serviceattributes.bigint_AttributeID ) WHERE 16_attributegroupings. bigint_ServiceID = ".$GLOBALS["[b]service[/b]"]." AND 16_attributegroupings. bigint_CategoryID = ".$row["[b]biginit_CategoryID[/b]"]." ORDER BY 3_serviceattributes.text_AttributeDescription ASC;"; $result0 = mysql_query_errors($sql0 , $conn , __FILE__ , __LINE__ , false); if ($result0) { while ($row0 = mysql_fetch_array($result0)) { echo " <catgroup id=\"". $row0["bigint_GroupID"]."\" desc=\"". $row0["text_AttributeDescription"]. "\" val=\"".$row0["text_AttributeValue"]. "\">\n"; $sql1 = "SELECT 15_validcombinations.bigint_ServiceID, 15_validcombinations.bigint_CombinationID, 15_validcombinations.bigint_CategoryID, 15_validcombinations.bigint_GroupID, 3_serviceattributes.bigint_AttributeID, 3_serviceattributes.text_AttributeValue FROM 15_validcombinations LEFT JOIN ( 3_serviceattributes ) ON ( 15_validcombinations. bigint_AttributeValueID = 3_serviceattributes. bigint_AttributeID ) WHERE 15_validcombinations. bigint_ServiceID = ".$GLOBALS["[b]service[/b]"]." AND 15_validcombinations. bigint_CategoryID = ".$row0["[b]biginit_CategoryID[/b]"]." AND 15_validcombinations. bigint_GroupID = ".$row0["bigint_GroupID"]." ORDER BY 3_serviceattributes.text_AttributeValue ASC;"; $result1 = mysql_query_errors($sql1 , $conn , __FILE__ , __LINE__ , false); if ($result1) { while ($row1 = mysql_fetch_array($result1)) { echo " <validattr id=\"". $row1["bigint_CombinationID"]. "\" value=\"". $row1["text_AttributeValue"]. "\"/>\n"; } } echo " </catgroup>\n"; } mysql_free_result($result0); } echo " </pricecat>\n"; } mysql_free_result($result); }} running the sql queries in pma, they get the valid values they are supposed to have. a testing group, and the second select statement the values of that group. however in php they are not displayed? 0oi will need to figure out what the values are that are being parsed. Link to comment Share on other sites More sharing options...
Greywacke Posted May 13, 2010 Author Share Posted May 13, 2010 the values passed are valid, both service id 1 and category id 1 same as used in the test for the second mysql query, the third query being skipped due to no loop. Link to comment Share on other sites More sharing options...
Greywacke Posted May 13, 2010 Author Share Posted May 13, 2010 [b]bigint_ServiceID bigint_CategoryID bigint_GroupID[/b]1 1 1[b]bigint_AttributeID text_AttributeDescription[/b]1 canopy_req is returned by the second query tested with the values returned from the first and [b]bigint_ServiceID bigint_CombinationID bigint_CategoryID bigint_GroupID[/b]1 1 1 11 2 1 1[b]bigint_AttributeID text_AttributeValue[/b]1 new_white12 pre-owned_colour_coded is returned by the third query tested with the values returned from the second query. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 13, 2010 Share Posted May 13, 2010 The $conn variable isn't in the local scope for that function. Link to comment Share on other sites More sharing options...
Greywacke Posted May 13, 2010 Author Share Posted May 13, 2010 i hear what you are saying, but i need to test something else first. you will notice some bold code in the function, these contain typos: $GLOBALS["service"] should be $GLOBALS["s"] and $row["biginit_CategoryID"] should be $row["bigint_CategoryID"] getting that variable then would be $GLOBALS["conn"], right? Link to comment Share on other sites More sharing options...
Greywacke Posted May 13, 2010 Author Share Posted May 13, 2010 actually it is for some reason - it works now and outputs the following xml: <pricecat> <catid>1</catid> <svcid>1</svcid> <catdesc>Category A</catdesc> <catprice>20</catprice> <catgroup id="1" desc="canopy_req" val=""> <validattr id="1" value="new_white"/> <validattr id="2" value="pre-owned_colour_coded"/> </catgroup> </pricecat> :)i guess it has something to do with global variables being turned on? Link to comment Share on other sites More sharing options...
Greywacke Posted May 13, 2010 Author Share Posted May 13, 2010 issue resolved ^^ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.