Categories | Question details Back To List | ||
2nd mysql query doesn't show values!? Hi there! I'm pretty new at this, so I'll need your help. Second MySQL query in parsed XML file doesn't show any data(!?), first one shows data OK..?! I've used StepByStep example with DHTMLX/PHP/XML code with included customized 'gridQString = \"getGridRecords.php\"' XML file: ... $link = mysql_pconnect("mydomain", "username", "pass"); $db = mysql_select_db ("dbname"); //create query to products table $sql = "SELECT * FROM Calendar"; //query database to retrieve necessary block of data $res = mysql_query ($sql); //output data in XML format echo "<rows total_count='".$totalCount."' pos='0'>"; while($row=mysql_fetch_array($res)) { // location column $sql_location = "select * from Locations where LocationID=" . $row['LocationID']; $result_location = mysql_query($sql_location); // pick location name & number while ($row = mysql_fetch_array($result)){ $LocationName = $row["LocationName"]; $LocationNr = $row["LocationNr"]; } echo "<row id=\"$red\">"; // location Nr echo "<cell bgColor=\"#f24023\">"; echo "$LocationNr"; // this result shows OK.. echo "</cell>"; echo "<cell bgColor=\"#ede56d\">"; echo "$LocationName"; // ...this one too.. echo "</cell>"; // panel column $sql_panel = "select * from Panels where PanelID=" . $row['PanelID']; $result_panel = mysql_query($sql_select_panel); // pick panel name while ($row = mysql_fetch_array($result_panel)) { $PanelName = $row["PanelName"]; } echo "<cell>"; echo "$PanelName"; // this result don't show up!? echo "</cell>"; echo "</row>"; } print("</rows>"); ... Tnx in advance! Xavier. Answer posted by Support on Nov 12, 2008 02:55 The problem most probably related to your php code and not related to components functionality. In your code $sql_panel = "select * from Panels where PanelID=" . $row['PanelID']; to which $row object your are reffering, the $row used by both upper level queries, so problem may be caused by incorrect collection usage. Answer posted on Nov 12, 2008 05:03 Hi there! Yes, PHP code was incorrect. Tnx for your answer, regards, Xavier. |