Whois request record in database
| From: | IS | Date: | Fri, 12 Sep 2003 09:33:47 +0000 |
| Subject: | Whois request record in database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162397@lists.php.net to get a copy of this message | ||
I want to record the whios requests people do, not the whois output, in
a MySQL database. Somebody helped me with the code here below, but I get
a parse error when I test it.
Parse error: parse error, unexpected $ in
/home/moo/public_html/whois/index.php on line 32
What can help me out?
<?php
if(!$name) {
print("
<form name=\"\" action=\"$PHP_SELF\" method=\"post\">
<input type=\"text\" name=\"name\">
</form>");
$db_name='databasename';
$db_user='user';
$db_password='password';
$table='whoistracker';
// Connect to the database
$db_conn = mysql_connect("localhost",$db_user,$db_password);
if (!$db_conn)
{
die ("ERROR: Cannot connect to the database.");
//exit();
}
$ip = $REMOTE_ADDR;
$insert="INSERT INTO $table (name,ipaddress) VALUES ('$name','$ip')";
$db_query=mysql_db_query($db_name,$insert);
if($name) {
if($dbquery) { print("Done."); } ELSE { print("Didn't work."); }
?>
--IS