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 “”;



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 “”;



echo “<cell bgColor=”#ede56d">";

        echo “$LocationName”; // …this one too…

echo “”;



// 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 “”;

        echo “$PanelName”; // this result don’t show up!?

echo “”;



echo “”;

}



    print("");









Tnx in advance!



Xavier.

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.

Hi there!

Yes, PHP code was incorrect. Tnx for your answer,

regards,

Xavier.