select max(newsid) from news
Basically the problem is, the name of the return result is not "newsid". When you use functions like max, total, count the returned result will not have the same field names you have in your database table. To fix it you need to define a name for it. like max(newsid) as xxx
try change it to
"select max(newsid) as maxid from news"
$id = $row["maxid"];
William