What's wrong with this code? I'm getting a blank page for this?
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', __DIR__);
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );
$app = JFactory::getApplication('site');
$db = JFactory::getDbo();
$user = JFactory::getUser();
$profile = JUserHelper::getProfile($user->id);
if( $user->username == 'THE_USER_1' )
{
$query = $db->getQuery(true);
$query->select($db->quoteName('username'));
->from($db->quoteName('#table_name#'));
->where($db->quoteName('username') . ' = '. $db->quote($user->username));
$db->setQuery($query);
$result = $db->loadResult();
if($result) {
echo "<p> You have already filled the form.</p>";
}
else {
// continue to form page
}
elseif( $user->username == 'THE_USER_2' )
{
// some code
}
else
{
echo "<p> Sorry, you can't access this page.</p>";
}
?>