i have this code
<?php
$mysql_host = "xxxx";
$mysql_database = "xxxxx";
$mysql_user = "xxxxxx";
$mysql_password = "xxxx";
$con = mysql_connect($mysql_host,$mysql_user,$mysql_password);
if (!$con)
{
echo "mysql error";
}
$ip=$_SERVER['REMOTE_ADDR'];
mysql_query("INSERT INTO stuff (ip)
VALUES ('$ip')");
mysql_close($con);
?>can somebody make this code so it displays a image and records your ip onto a mysql database?
thanks,
flash
Offline
flashgocrazy wrote:
i have this code
Code:
<?php $mysql_host = "xxxx"; $mysql_database = "xxxxx"; $mysql_user = "xxxxxx"; $mysql_password = "xxxx"; $con = mysql_connect($mysql_host,$mysql_user,$mysql_password); if (!$con) { echo "mysql error"; } $ip=$_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO stuff (ip) VALUES ('$ip')"); mysql_close($con); ?>can somebody make this code so it displays a image and records your ip onto a mysql database?
thanks,
flash![]()
I'm not sure. Is there any errors coming up? Also, I was trying to do this once too, but it didn't work.
Offline
WindowsExplorer wrote:
flashgocrazy wrote:
i have this code
Code:
<?php $mysql_host = "xxxx"; $mysql_database = "xxxxx"; $mysql_user = "xxxxxx"; $mysql_password = "xxxx"; $con = mysql_connect($mysql_host,$mysql_user,$mysql_password); if (!$con) { echo "mysql error"; } $ip=$_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO stuff (ip) VALUES ('$ip')"); mysql_close($con); ?>can somebody make this code so it displays a image and records your ip onto a mysql database?
thanks,
flash![]()
I'm not sure. Is there any errors coming up? Also, I was trying to do this once too, but it didn't work.
no errors, its just not posting the ip in the database
Offline
flashgocrazy wrote:
i have this code
Code:
<?php $mysql_host = "xxxx"; $mysql_database = "xxxxx"; $mysql_user = "xxxxxx"; $mysql_password = "xxxx"; $con = mysql_connect($mysql_host,$mysql_user,$mysql_password); if (!$con) { echo "mysql error"; } $ip=$_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO stuff (ip) VALUES ('$ip')"); mysql_close($con); ?>can somebody make this code so it displays a image and records your ip onto a mysql database?
thanks,
flash![]()
you need to give mysql_query $con as well
Last edited by TRocket (2011-12-29 10:47:51)
Offline
TRocket wrote:
flashgocrazy wrote:
i have this code
Code:
<?php $mysql_host = "xxxx"; $mysql_database = "xxxxx"; $mysql_user = "xxxxxx"; $mysql_password = "xxxx"; $con = mysql_connect($mysql_host,$mysql_user,$mysql_password); if (!$con) { echo "mysql error"; } $ip=$_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO stuff (ip) VALUES ('$ip')"); mysql_close($con); ?>can somebody make this code so it displays a image and records your ip onto a mysql database?
thanks,
flash![]()
you need to give mysql_query $con as well
do you have the code for it?
Offline
you need to specify a database to connect to
http://www.php.net/manual/en/function.m … ect-db.php
mysql_select_db($mysql_database);
Offline
<?php
$mysql_host = "xxxx";
$mysql_database = "xxxxx";
$mysql_user = "xxxxxx";
$mysql_password = "xxxx";
$con = mysql_connect($mysql_host, $mysql_user, $mysql_password);
mysql_select_db($mysql_database, $con);
if (!$con)
{
echo "mysql error";
}
$ip=$_SERVER['REMOTE_ADDR'];
mysql_query("INSERT INTO stuff (ip)
VALUES ('$ip')", $con);
mysql_close($con);
?>Try this.
Offline
WindowsExplorer wrote:
Code:
<?php $mysql_host = "xxxx"; $mysql_database = "xxxxx"; $mysql_user = "xxxxxx"; $mysql_password = "xxxx"; $con = mysql_connect($mysql_host, $mysql_user, $mysql_password); mysql_select_db($mysql_database, $con); if (!$con) { echo "mysql error"; } $ip=$_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO stuff (ip) VALUES ('$ip')", $con); mysql_close($con); ?>Try this.
exactly, although you don't need to specify the connection in the mysql_select_db parameters but you can anyway
Offline
Topic closed by request of topic owner *Jumps up and flies into the sunset*

Offline
wierd, its not closed
Offline
flashgocrazy wrote:
wierd, its not closed
Yikes, I guess I closed my browser tab too soon before the thread got closed. It's closed now.

Offline