alexa-tracking

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/57f7de6f2e04c80f6e8b4567/ask-selalu-otomatis-gagal-memasukkan-data-ke-database
[ASK] Selalu Otomatis Gagal Memasukkan Data ke Database
Hallo gan,

Ane mau nanya nih, ceritanya ane mau masukin data IP Address pengunjung web ane secara otomatis pas mereka mengunjungi web.

Code:


// masukan ke database
$host="localhost";
$username="root";
$password="";
$databasename="data_ip";
$connect=mysql_connect($host,$username,$password);
$db=mysql_select_db($databasename);

mysql_query("insert into detekip(ip) values('$ip)");



Kok gagal ya emoticon-Sorry

Mohon bantuannya emoticon-Shakehand2
missing quote

mysql_query("insert into detekip(ip) values('$ip')");
Quote:Original Posted By adyoi
missing quote

mysql_query("insert into detekip(ip) values('$ip')");


ane coba dulu gan emoticon-Shakehand2


edit: case close, dah dipake jawaban di atas juga sama ternyata. eh berhasil pas ganti mysql ke mysqli.

emoticon-Ultah
$link=mysqli_connect($host,$username,$password, $dbname) or die("Cannot connect DB");
mysqli_query($link, $sql="insert into detekip(ip) values('$ip)") or die($sql."<br/>".mysqli_error($link));