Date: 11/22/00
- Next message: php3 <email protected>: "Re: [PHP-DB] mysql reinstall??"
- Previous message: Mattias Segerdahl: "Re: [PHP-DB] How BIG can this problem be? ---->"
- In reply to: Jeof Oyster: "[PHP-DB] problems inserting in specific row"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>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','statu
>sinterview')
>where username=\'username\'";
>mysql_db_query($db,$query,$connection) or die("Error in query");
Sir,
INSERT INTO always inserts a new row into the table. In the context,
MySQL is choking because the WHERE clause doesn't make any sense. To
change an existing row, use the UPDATE statement.
Bob Hall
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: php3 <email protected>: "Re: [PHP-DB] mysql reinstall??"
- Previous message: Mattias Segerdahl: "Re: [PHP-DB] How BIG can this problem be? ---->"
- In reply to: Jeof Oyster: "[PHP-DB] problems inserting in specific row"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

