Re: problems inserting in specific row
| From: | omar cromwell mercado | Date: | Wed, 22 Nov 2000 03:03:31 +0000 |
| Subject: | Re: problems inserting in specific row | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4633@lists.php.net to get a copy of this message | ||
From your requirements, it appears to me that you want
to "update" a user's record with their answers,
instead
of adding new records. If that is the case, your
query should be "update" not "insert":
$query="update et01app_gen set
lisalvation='$lisalvation', lireasons='$lireasons',
lifamilylife='$lifamilylife',
lileadership='$lileadership',
statusinterview='$statusinterview' where
username='$username'";
omar
--- Jeof Oyster <jeof@jeof.net> wrote:
> Can you tell me what is wrong with my code?
>
> What I'm doing is this:
> I have a form that users answer questions and then
> submit. The Action
> calles GET the same document, with all the form
> variables inserted in.
> What is supposed to happen is that php is supposed
> to enter the user's
> answers into our database, but only in the proper
> record (based on
> variable username). So the info for Joe_Smith is
> entered only into the
> record where the username field equals "Joe_Smith".
> I keep getting an
> error in query and don't know where I'm going wrong.
>
> $server = "aaaa";
> $user = "bbbbb";
> $pass = "ccccc";
> $db = "dddddt";
> $connection = mysql_connect($server, $user, $pass);
> // formulate and run query
> $query = "insert into
>
et01app_gen(lisalvation,lireasons,lifamilylife,lileadership,statusinterview)
>
values('lisalvation','lireasons','lifamilylife','lileadership','statusinterview')
> where username=\'username\'";
> mysql_db_query($db,$query,$connection) or die("Error
> in query");
>
>
> Thanks!
> Jeof Oyster
> Top Flight Leadership
>
> PS- Please hit reply to all so I receive a copy of
> your reply, and then
> come back to read more. Thanks
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-db-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-db-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/