<?php
include ("connect.php");

$result = $dbh->query("select * from expenses");
$row = $result->fetchObject();
$count = $result->rowCount();

if($count>0){
	do{
	$updateexpenses = $dbh->query("update expenses set remain='$row->cost' where expid='$row->expid'");
}while($row = $result->fetchObject());
}
?>