Re: PHP help

From: Date: Mon, 30 Jun 2003 09:56:44 +0000
Subject: Re: PHP help
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-20624@lists.php.net to get a copy of this message
i found some mistakes here! if register_globals = Off in php.ini $query="INSERT INTO login VALUES (" . $_POST['login'] . ")"; if register_globals = On in php.ini $query="INSERT INTO login VALUES (" . $login . ")"; Rodel D. Bautista wrote:
Sir, kindly try these lines: 1) $query="INSERT INTO login VALUES ("$_POST('login')")" 2) $query="INSERT INTO login VALUES ("$_REQUEST('login')")"; or check in your php.ini file the line register_globals = on/off should be "on" if you wish to use $query="INSERT INTO login VALUES ("$login")"; Note: I've observed an extra double quote in the line above in your script. I hope this can help. Rodel D. Bautista
-----Original Message----- From: Bill Pilgrim [SMTP:billpilgrim2000@yahoo.com] Sent: Monday, June 30, 2003 1:30 PM To: php-windows@lists.php.net Subject: [PHP-WIN] PHP help My System: Windows 98 Apache 1.3.27 PHP 4 mysql Hello all, I am a PHP beginner and was wondering if I could get some help from some of the more experienced on this list. I have been trying to use an html form (with textboxes, radio buttons, and textareas) to input data into a mysql database. I am able to connect fully with the database and am able to create tables in it, but when I try to input information into the tables nothing happens. ever... I don't really know what to do from here, but I assume that a configuration is not set properly between mysql, apache, windows, or php. I really don't know what it could be. My code is here and I have tried to simplify the form in order to get it working, so here is my barebones code that hopefully has some errors: HTML: <html> <head> <title>Simplify</title> </head> <body> <form action="addform.php" method="post"> Login: <input type="text" name="login"> <input type="submit"> </form> </body> </html> PHP file called "addform.php": <? $user="chris"; $database="test"; mysql_connect(localhost,$user); @mysql_select_db($database) or die("unable to select database"); $query="INSERT INTO login VALUES ("'$login')"; mysql_query($query); mysql_close(); ?> Login is the name of the table on the database named test. I stopped using a password because it wouldn't let anything work even table creation when I tried to use a password. Any help that anyone could give would be greatly appreciated; there is probably some grievious error in this script. Thanks, Chris --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month!


« previous php.windows (#20624) next »