how to make total visitors count system in website - Learn With Riwash

Breaking

Learn With Riwash

learn with riwash learn with riwash is the personal blog/youtube channel that provide best knowledge of software development. Here we give complate trainning of techonology as will as build software. We teach you related to web developing and programming in html,javascript,php,python,c++, c#, java programming ect. It is not a complate teaching siti like W3schools but it it a blog where we give code that help you to become better programmer.

ads

Post Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

Tuesday, March 13, 2018

how to make total visitors count system in website


Hello friends in this artical i am going to teach you
how to make total visitors count system in website
using php and mysql. Here we use php and sql for visitors counts.
1st we need to connect database using sql.
<?php
//this is sql database connect
$conne= mysql_connect ("localhost", "root", "") or die("could not connect db here");
mysql_select_db("mydbname") or die(" sorry could not find database");

?>

What we do here ?
here we connect database using sql
$conne is a variable that store value of mysql_connect. we have local server so we write local host.
root is name and password is empty. our database name is mydbname.

now here we are use php for count.

<?php
//here for visitors count
$find_counts=mysql_query("SELECT * FROM our_user_count");

//here $find_counts is a variable that select db table from our_user_count.
//our_user_count is our database table
while($row=mysql_fetch_assoc($find_counts))
{
$our_counts= $row['counts'];
$new_v_count= $our_counts +1;
$update_count =mysql_query("UPDATE `mydbname`. `our_user_count` SET `counts` =$new_v_count ");

}
?>
here 1st we store value in variable and store in database now if you want po get data for database and
shows in website just write
<?php
echo $find_counts;
?>
This is a way you can create visitors counts in your website or blog.

No comments:

Post Top Ad

Responsive Ads Here