try this
In this modified code, the line unset($member_data['Member_ID']); removes the "member_id" key from the $member_data array so that it is not echoed in the JSON response.
Code:
<?phpdefine('_JEXEC', 1);error_reporting(E_ALL);ini_set('display_errors', 1);use Joomla\CMS\Factory;define('JPATH_BASE', realpath(dirname(__FILE__)));require_once JPATH_BASE . '/includes/defines.php';require_once JPATH_BASE . '/includes/framework.php';$app = new Joomla\CMS\Application\SiteApplication();\Joomla\CMS\Factory::$application = $app;$db = Factory::getContainer()->get('DatabaseDriver');$member_id = $app->input->getVar('member_id', '');if ($member_id != '') { $query = 'SELECT * FROM jos_credits WHERE Member_ID = ' . $db->quote($member_id); $db->setQuery($query); $member_data = $db->loadAssoc(); if (is_null($member_data)) { echo "This member number doesn't exist, please check your number"; exit; } // Remove the echo statement for member_id unset($member_data['Member_ID']); // Echo the member data as JSON echo json_encode($member_data);}?>
Statistics: Posted by Matt Bourne — Sun Jan 21, 2024 3:07 am