I have a simple question regarding PHP to check if this is the last row of MySQL or not. For example I have this code :
$result = mysql_query("SELECT *SOMETHING* ");
while($row = mysql_fetch_array($result))
{
if (*this is the last row*)
{/* Do Something Here*/}
else
{/* Do Another Thing Here*/}
}
I have difficulties to check if the row is the last one or not. Any idea how to do it? Thanks.
mysql_*functions in new code. They were removed from PHP 7.0.0 in 2015. Instead, use prepared statements via PDO or MySQLi. See Why shouldn't I use mysql_* functions in PHP? for more information./* Do Something Here*/that matters here. Are you mutating the data or are you printing data. There may be a better way to achieve what you want without performing iterated conditions.