|
 |
|
อยากทราบวิธีการ ทำการนับจำนวนคนดูในหน้านั้นๆ ติดปัญหาไม่รู้ว่าจะต้องใส่โค้ดตรงไหน |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php require_once('Connections/config.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_animes = "-1";
if (isset($_GET['id'])) {
$colname_animes = $_GET['id'];
}
mysql_select_db($database_config, $config);
$query_animes = sprintf("SELECT * FROM manager WHERE id = %s", GetSQLValueString($colname_animes, "int"));
$animes = mysql_query($query_animes, $config) or die(mysql_error());
$row_animes = mysql_fetch_assoc($animes);
$totalRows_animes = mysql_num_rows($animes);
mysql_select_db($database_config, $config);
$query_facebookreport = "SELECT facebook FROM managerweb";
$facebookreport = mysql_query($query_facebookreport, $config) or die(mysql_error());
$row_facebookreport = mysql_fetch_assoc($facebookreport);
$totalRows_facebookreport = mysql_num_rows($facebookreport);
$colname_animesid = "-1";
if (isset($_GET['id'])) {
$colname_animesid = $_GET['id'];
}
?>
อยากทราบวิธีการนับคนดูในหน้านั้นๆ (view counter)
ผมลองดูหลายๆคลิปนี่เขาบอกว่าใส่ตามนี่ $sql ="Update manager Set mview=mview+1 Where id='id'";
แต่ผมไม่รู้ว่าจะมาปรับใช้กับโค้ดผลยังไงครับ
อันนี่ฐานข้อมูล

Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2016-05-13 01:28:00 |
By :
MilkyHolmes |
View :
920 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 04
|