I m making a galey script in which i want to implement "number of times picture viewed". how i can do that.plz write code. thanks
Add a field to the images table called "views" for example. And on the image view page you do something like: mysql_query("UPDATE images SET (views = views + 1) WHERE imageid = " . $imageid . " LIMIT 1") OR die(mysql_error()); PHP:
Dear i have this code where to put ur code in this php code. <?php if (!ini_get("register_globals")) { import_request_variables('GPC'); } // $phpver = phpversion(); if ($phpver < '4.1.0') { $_GET = $HTTP_GET_VARS; $_POST = $HTTP_POST_VARS; $_SERVER = $HTTP_SERVER_VARS; } $phpver = explode(".", $phpver); $phpver = "$phpver[0]$phpver[1]"; if ($phpver >= 41) { $PHP_SELF = $_SERVER['PHP_SELF']; } include("config.php"); $result = mysql_query("SELECT * FROM bsongs WHERE id='$id' ",$connect); while($r = mysql_fetch_assoc($result)) { //the format is $variable = $r["nameofmysqlcolumn"]; //modify these to match your mysql table columns $id=$r["id"]; $name=$r["name"]; $details=$r["details"]; $song1=$r["song1"]; $song2=$r["song2"]; $song3=$r["song3"]; $song4=$r["song4"]; $song5=$r["song5"]; $song6=$r["song6"]; $song7=$r["song7"]; $song8=$r["song8"]; $song9=$r["song9"]; $song10=$r["song10"]; $song11=$r["song11"]; $song12=$r["song12"]; $song13=$r["song13"]; $song14=$r["song14"]; $url1=$r["url1"]; $url2=$r["url2"]; $url3=$r["url3"]; $url4=$r["url4"]; $url5=$r["url5"]; $url6=$r["url6"]; $url7=$r["url7"]; $url8=$r["url8"]; $url9=$r["url9"]; $url10=$r["url10"]; $url11=$r["url11"]; $url12=$r["url12"]; $url13=$r["url13"]; $url14=$r["url14"]; //display the row echo "<br> $name <br>"; echo "<br> $details <br>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url1'>$song1</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url2'>$song2</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url3'>$song3</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url4'>$song4</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url5'>$song5</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url6'>$song6</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url7'>$song7</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url8'>$song8</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url9'>$song9</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url10'>$song10</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url11'>$song11</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url12'>$song12</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url13'>$song13</a>"; echo "<br>"; echo "<img src=\"icon2.gif\"><a href='$url14'>$song14</a>"; echo "<br>"; echo "<br>"; echo "In order to play this rm files , you need to have Realone Player.Click Image below to download RealOne Player"; echo "<br>"; echo "<a href=\"http://www.real.com/R/RDX.fail-click.R/software-dl.real.com/060421e6084e73075305/windows/mrkt/R30APD/RealPlayer10-5GOLD.exe\"><img src=\"realone.jpg\"></a>"; echo "<br> ********************* <br>"; } ?> PHP: