// url nya: abcd.com/jumlahklik.php?idads=[idadsnya]

$con = mysql_connect("localhost","root","");

mysql_select_db("freescript", $con);

// kalo ada yg click  tambahkan jumlah klik 

$count = 0;
if ($_GET['idads']==1)

$waktu = date('Y-m-d H:i:s');
$idads = 1;
$date = date('Y-m-d');
$time = date('H:i:s');

mysql_query("insert into adsmgt (idads,waktu,date,time) values ('$idads', '$waktu', '$date', '$time')");


//di jumlahklik.php tinggal bikin script buat save ke database

//dibawahnya tinggal kasih header("location:alamat url aslinya");exit();

// print jumlah klik dalam graphic

$result = mysql_query("SELECT COUNT(idads) AS countidads FROM adsmgt") or die(mysql_error()); 

$resultday = mysql_query("SELECT COUNT(idads) AS countidadsday FROM adsmgt GROUP BY date") or die(mysql_error());

while($row = mysql_fetch_assoc($result))
echo "Number of ad clicks: ".$row['countidadsday'];


$result2 = mysql_query("SELECT waktu, date, time FROM adsmgt") or die(mysql_error());

echo "<br>";
echo "<br>"."Tanggal"."&nbsp&nbsp&nbsp"."&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspWaktu"."&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspJumlah clicks per hari";

while($row2 = mysql_fetch_array($result2))
echo "<br>".$row2['date']."&nbsp&nbsp&nbsp".$row2['time']."&nbsp&nbsp&nbsp".$row['countidadsday'];

while($rowday= mysql_fetch_array($resultday))
echo $rowday['countidadsday'];


// Graph - http://www.ebrueggeman.com/phpgraphlib/examples


    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
    google.load("visualization", "1", {packages:["corechart"]});
    function drawChart() {
    var data = google.visualization.arrayToDataTable([
    ['date', 'Number of clicks per hari'],
    $data = array(
    //$resultday = mysql_query("SELECT `date`,COUNT(idads) AS `numclicks` FROM adsmgt GROUP BY date") or die(mysql_error());
    $i = 0;
    //while($row = mysql_fetch_assoc($resultday)){
    foreach($data as $row){
    if($i == 0){
    echo "['{$row['date']}', {$row['numclicks']}]";
    echo ",['{$row['date']}', {$row['numclicks']}]";
    var options = {
    title: 'Company Performance',
    hAxis: {title: 'Date', titleTextStyle: {color: 'red'}}
    var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
    chart.draw(data, options);
    <div id="chart_div" style="width: 900px; height: 500px;"></div>

Notice: Undefined index: countidadsday in C:\xampp\htdocs\Innovation\script_shop\adsmgt.php on line 40

line 40: echo "Number of ad clicks: ".$row['countidadsday'];

Tanggal(date) waktu (time) Jumlah clicks per hari(number of clicks each day)

2013-01-23 03:25:03
2013-01-23 03:29:28
2013-01-23 03:40:12
2013-01-23 03:40:45
2013-01-23 03:41:25 4012114112352611255

I wonder where: 4012114112352611255 comes from?

5 Years
Discussion Span
Last Post by davy_yg

appologize. I thought I would give more space for commenting since my previous post already have around 20 replies.


Please keep to a single thread. You may alienate contributors who may take it that you're dissatisfied with their input thus far.


ok. I'll close this thread. Still please help me with the previous thread. Thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.