Tuesday, 9 June 2020

how to get the ipaddress of customer

how to get the ipaddress of customer
<?php
ist connect to database, using require
require 'lesson44.php';
write query to insert + execute+
$user_ip = $_SERVER ['REMOTE_ADDR'];
get the ipaddress of customer and stores into userip variable
//ipaddress of this server

function add_ip ($ip){
write the function to update into database
global $mycon;
we cant use directly global variable for that purpose use global
// if we want to use outside variable in function
$query = "INSERT INTO `hits_ipaddress` (`id`, `ip`) VALUES(NULL, '$ip')";
it is updat into data base, update into database ussing id, hits with no value and ipadress of customer
// write a statement or query to insert into  table
mysqli_query($mycon, $query);
runs this query against database
 //run this query on this database
}

?>
how to use the template values and data
require
how to get the ipaddress of custoemr
 $_SERVER ['REMOTE_ADDR']
how to write afunction to add ipaddress
function
how to write a function to use global variable
global
how towrite a query to update to database
query
INSERT INTO VALUE
how to execute a query
mysqli_query



No comments:

Post a Comment