Re: basic form entry

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

 



INSERT inserts new data to database. If you want to update data, use
UPDATE instead of INSERT.

Olavi Ivask
I have been racking my brains trying to figure out what I am doing wrong.
> i
> have created a basic form that calls requests user information...the form
> then runs insert.php.  No errors are returned, however, my database does
> not
> update.  Any suggestions? thanks
>
> The field names in the table are correct (case).
>
>
> SUBMIT.HTML:
>
> <form action="insert.php" method="post">
> First Name: <input type="text" name="first"><br>
> Last Name: <input type="text" name="last"><br>
> Phone: <input type="text" name="phone"><br>
> Mobile: <input type="text" name="mobile"><br>
> E-mail: <input type="text" name="email"><br>
> Web: <input type="text" name="web"><br>
>
> <input type="Submit" value="click para enviar">
>
> </form>
>
>
> INSERT.PHP
>
> <? php
> echo"hello"
> $username = "guest";
> $psswd = "password";
> $db = "contacts";
> $host = "localhost";
>
> $first_name = $_POST['first'];
> $last = $_POST['last'];
> $phone = $_POST['phone'];
> $mobile = $_POST['mobile'];
> $email = $_POST['email'];
> $web = $_POST['web'];
>
> mysql_connect($host,$username,$psswd) or die ("errror in access db");
> mysql_select_db($db);
>
>
>
>
> mysql_query ("INSERT INTO users (First,Last,Phone,Mobile,Email,Web) VALUES
> ('$first_name','$last','$phone,'$mobile','$email','$web') ");
>
> echo('$username','$last')
>
> echo mysql_error(mysql_connect($host,$username,$psswd));
>
> ?>
>
> --
> 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


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

  Powered by Linux