RE: Re: PHP help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



think you miss something


try this : 

print_r($_POST);


cause from a specific php version (above 4) al lthe form vars are in a
special array called ($_POST)   (when submitted by a form)


so you should do:

query="INSERT INTO login VALUES ('$_POST[login]')";

I also removed a "  you got one to many!!!!


hope this works!


-mark-




-----Original Message-----
From: Shivanischal A [mailto:shivan@subexgroup.com]
Sent: maandag 30 juni 2003 13:13
To: php-db@lists.php.net
Subject:  Re: 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);


localhost should probably be  $localhost  OR    'localhost'    (?)


> @mysql_select_db($database) or die("unable to select database");
> $query="INSERT INTO login VALUES ("'$login')";


you can safely say -  $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


mentioning a password should do no harm. try  $query="INSERT INTO login
VALUES ('$login', password($password))";
password() is a mysql function. its irreversible; somehting on the like that
we have on LiNUX systems

regards,
-shiva



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux