He probado con PHP y a mí me funciona el script siguiente:
Código:
<?php
$link = mysql_connect ('localhost', 'uno', 'otro');
if (!$link){
echo 'error al conectar';
die;
}
$bd = mysql_select_db('diegoluisr');
if (!$bd){
echo 'error al seleccionar la base d datos';
die;
}
mysql_query ("SET NAMES 'utf8'");
function getLastId(){
$query= "SELECT id FROM article WHERE article_type = 1 ORDER BY apointmentdate DESC LIMIT 1";
$getid=mysql_query($query);
if (mysql_num_rows($getid)>0){
$arr_array = mysql_fetch_array($getid);
return $arr_array[0]['id'];
} else {
return 0;
}
}
echo getLastId();
?>
Comprueba las versiones de PHP que usas en local y la del servidor, y la sintaxis de tu PHP