Whios request record in database
| From: | IS | Date: | Fri, 12 Sep 2003 11:31:50 +0000 |
| Subject: | Whios request record in database | ||
| Groups: | php.db php.db | ||
| Request: | Send a blank email to php-db+get-30474@lists.php.net to get a copy of this message | ||
I want to record the whois requests people do, not the whois output, in
a MySQL database.
The following code I'm playing with, but it doesn't write anything to my
table. What's wrong?
<?php
if(!$name)
{
print("<form name=\"\" action=\"$PHP_SELF\"
method=\"post\">
<input type=\"text\" name=\"name\">
<input type=\"submit\" name=\"name\">
</form>");
$db_name='dbname';
$db_user='username';
$db_password='password';
$table='tablename';
// 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="select * from $table";
$db_query=mysql_db_query($db_name,$insert);
if($name)
{
if($dbquery)
{ print("Done.");
}
else
{ print("Didn't work.");
}
}
}
?>
--IS