We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28970
    • 1 Posts
    Hi

    Im new to MODX and have been stuck on a "mission"

    I want to read from a own database on the same server where i have MODX, i want the SQL-result to be written on a document.
    How do i do that?
    Have been searching through the forum but didnt find something for me, perhaps im blind smiley


    Solved it after a night sleep with following snippet.

    <?php
    mysql_select_db ("database");
    $query = "SELECT klick FROM ms_download WHERE id = ’1’";
    $result = mysql_query($query);
    if (mysql_affected_rows() == 0)
    {
    echo "0";
    }
    else
    {
    while($f=mysql_fetch_array($result))
    {
    $klick = $f["klick"];

    echo " $klick";
    }
    }
    ?>