echo count($basket);
<?
if(isset($_POST['id_user']))
{
$user=$_POST['id_user'];
$tovar=$_POST['id_tov'];
mysql_query("INSERT INTO `basket`(`id`, `id_user`, `id_tov`) VALUES ( NULL, '$user', '$tovar')");
$a=mysql_query("select * from `tovar` where `id`=$tovar");
$s=mysql_fetch_assoc($a);
echo $s['name_t'];
}
?>
SELECT COUNT(*) as count FROM `basket` WHERE `id_user` = '$user';