You have missed the braces. Close it properly.  The following code works
well

<?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.");
           }
      }
 }
?>

-Murugesan


----- Original Message -----
From: "IS" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 12, 2003 3:03 PM
Subject: [PHP] Whois request record in database


> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to