Jump to content
php.lv forumi

counter


IBEX
 Share

Recommended Posts

	  $sql = "SELECT counter FROM video WHERE video_id = {$_GET['video_id']}";
  $result = mysql_query($sql) or die (mysql_error());
  $rows = mysql_fetch_array($result);

  $page_views = $rows['counter'];

  if (empty($page_views)) { 
	 $page_views = "1"; 
 mysql_query("INSERT INTO video (counter)VALUES('1') WHERE video_id = {$_GET['video_id']}");
  }



  $page_views++;
  $sql = "UPDATE video SET counter = $page_views WHERE video_id = {$_GET['video_id']}";
  $result = mysql_query($sql) or die (mysql_error());

 

Kas sheit ir nepareizi?.. man liekas ieksha nevis 1, bet 2..

Link to comment
Share on other sites

 Share

×
×
  • Create New...