<?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.
Try this:
$sinani = $modx->getPlaceholder('user.schoolname');
Is the first echo working?