the view_count of the notes table will increment 2 times everytime i click the button that link into this page..
need help desperately.. thanks!
<?php
ob_start();
$note_id=$_GET['note_id'];
include 'fconnect.php';
if ($note_id!=null) {
$query_ncount = "UPDATE notes SET view_count = (view_count+1) WHERE note_id = '$note_id'";
$result_ncount = mysql_query($query_ncount);
if(!$result_ncount ){
die('invalid query :' .mysql_error());
}
}
$note_result = mysql_query("SELECT * FROM notes WHERE note_id ='$note_id'");
while($row = mysql_fetch_array($note_result))
{
$filename = $row['note_name'];
$file = $row['note_path'];
}
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
@readfile($file);
ob_end_flush();
?>