Sorry if you receive this mail for a second time.
I don't know if my first sending was OK.

---------------------------------------------------------------------
Hi,
I'm new on this ML and PHP. But if I can help ...

It seems you forgot a $ in your 'description' request in the '$sql' query.

$sql = "INSERT INTO tbl1 (name,location,length,size,description) VALUES
('$name','$location','$length','$size','description')";


Horst

> -----Message d'origine-----
> De:   pilotdave [SMTP:[EMAIL PROTECTED]]
> Date: lundi, 4. mars 2002 18:27
> À:    [EMAIL PROTECTED]
> Objet:        Re: [PHP-WIN] cannot write to mySQL database
> 
> 
> "Nicole Amashta" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Could you post the code you are trying to use to do this? It may just be
> a
> > coding issue and not MySQL at all.
> >
> 
> 
> Sure.  The database is called movies1db, username is movies, password is
> database.  This definitely could be an issue with how i set up the user or
> something.  Here's the code for one form I'm trying:
> -------
> <html>
> <body>
> <?php
> 
> if ($submit) {
> 
>   // process form
> 
>   $db = mysql_connect("localhost", "movies","database");
> 
>   mysql_select_db("movies1db",$db);
> 
>   $sql = "INSERT INTO tbl1 (name,location,length,size,description) VALUES
> ('$name','$location','$length','$size','description')";
> 
>   $result = mysql_query($sql);
> 
>   echo "Thank you! Information entered.\n";
> 
> } else{
> 
>   // display form
> 
>   ?>
> 
>   <form method="post" action="<?php echo $PHP_SELF ?>">
> 
>   Name:<input type="Text" name="name"><br>
> 
>   Location:<input type="Text" name="location"><br>
> 
>   Length:<input type="Text" name="length"><br>
> 
>   Size:<input type="Text" name="size"><br>
> 
>   Description:<input type="Text" name="description"><br>
> 
>   <input type="Submit" name="submit" value="Enter information">
> 
>   </form>
> 
>   <?php
> } // end if
> ?>
> </body>
> </html>
> ------
> 
> Here's more info.  I checked my apache error log and found that when I
> open
> that page, I get the following errors:
> [Mon Mar 04 12:14:27 2002] [error] PHP Warning:  Undefined variable:
> submit
> in c:\homepage\phptest\dataform2.php on line 11
> [Mon Mar 04 12:14:27 2002] [error] PHP Warning:  Undefined variable:
> PHP_SELF in c:\homepage\phptest\dataform2.php on line 37
> 
> I get the same errors when I hit the submit button.  Hope this helps!
> 
> Dave
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to