[PHP-DB] Whios request record in database
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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Whios request record in database
In order to insert data into database you'll need an insert statement I only see select * from $table Jack -Original Message- From: IS [mailto:[EMAIL PROTECTED] Sent: Friday, September 12, 2003 1:32 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Whios request record in database 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Whios request record in database
couple possible problems. 1. register globals being off and you're using variables like $name instead of $_POST['name']. 2. you're not asking that anything be written to the database, only selecting $insert=select * from $table; $db_query=mysql_db_query($db_name,$insert); 3. you're cheking if $name exists in the same code block that you've only entered if $name does NOT exist. you have some overlapping/unlclosed if brackets hth Jeff IS [EMAIL PROTECTED]To: [EMAIL PROTECTED] cc: 09/12/2003 07:31 Subject: [PHP-DB] Whios request record in database AM 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php