im a new guy in php i want help ,i google a lot about it but couldn’t figure it out. I want to write ips of sites from the table url into a database in a row known as ips.
I use gethostbyname to get IP, now what I want to do is get ip of that site stored in url row and store that IP in ips row of the table but I’m nt able to do it: only the first row’s URL IP is written in all of the ips columns. Please tell me how to write each URL’s IP in the ips column of the corresponding row.
<?
include"cfg/db.php";
$mirror_al =
mysql_query("SELECT * FROM kayitlar");
$mirror = mysql_fetch_array($mirror_al);
$siteip=$mirror['url'];
$shrt=substr($siteip, 7);
$url = rtrim($shrt,"/");
$mystring = $url;
$parts = explode("/",$mystring);
$mystring = $parts['0'];
$fullip=gethostbyname($mystring);
echo $fullip;
$ekle2 = mysql_query("UPDATE kayitlar set ips='$fullip'"); ?>
i’m not sure why you GET
idif you don’t use it anywhere… i’ve addedsiteidfrom database – please see if it works: