<?php
//For Give Information Of SQL
$counter=9;
$page = @$_GET['page'];
if($page=='0') $page=1;
if($page=='') $page=1;
$start=($page-1)*$counter;
$sql="SELECT * FROM `ALL` ORDER BY `id` DESC LIMIT ".$start.",".$counter."";
$result = mysql_query($sql);
while($rec = mysql_fetch_assoc($result)){
?>
<div class="box">
<a href="like.php?like=<?php echo $rec['id']; ?>" title="لايک کردن">
<button class="btn"> <?php echo str_replace('@',"",$rec['like']) ?> </button></a>
</div>
<?php
};
?>
<?php
include("main/engine/config.php");
if(isset($_GET["like"]))
{
$like=intval($_GET["like"]);
mysql_escape_string($like);
$sql="UPDATE ALL SET `like` = `like`+1 WHERE id='".$like."'";
$query=mysql_query($sql);
if($query)
{
header("Location:index.php?like=1");
}
}
else
{
header("Location:index.php?like=0");
}
?>
برچسب:
نویسنده: محمد رضا جوادیان