Search code examples
phpmysqlphpmyadminjoomla2.5

PHP echo only returning 1 digit results


When I query the DB itself, both queries return the correct number of results. However, when I drop this code into Joomla 2.5, it will only return up to the number 9. After that, if there's more, it will only display the first digit. So, basically, 11 should be the result, but it will only display 1. Please help!

SELECT count( * ) as column_name FROM `db`  
WHERE column_name >= DATE_FORMAT(NOW('0000-00-00'), '%Y-%m-01')

The echo within the PHP: <?php echo $column_name [0]; ?>


Solution

  • Just use <?php echo $column_name; ?>, the [0] you've added means "the first character of the string", so you'll receive 1 for 12, or 4 for 42.