We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33988
    • 110 Posts
    <?php
    echo "<b><center>Database Output</center></b><br><br>";
    
    $sinani = $modx->getPlaceholder(['user.schoolname']);
    $query  = "SELECT f_name, l_name, school_n FROM reg_student WHERE reg_student.school_n = '$sinani'";
    echo "TEST";
    $result = mysql_query($query);
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
        echo "First Name :{$row['f_name']} <br>" .
             "Last Name : {$row['l_name']} <br>";
    }
    ?>


    I want the above code to query the database and show the info for all the students whose school matches the parameter. But for some reason, nothing ever appears. I have verified that the parameter is set and that the database has data that should display but the snippet just isnt working.

    Note: the echo "TEST" isnt working either.
      Sal Sodano
      President & Co-Founder of SkyToaster
      My Website Salscode.
      • 3749
      • 24,544 Posts
      Try this:

      $sinani = $modx->getPlaceholder('user.schoolname');


      Is the first echo working?
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting