Re: [PHP] update statement
Hi, I got a series of string value in this format ie: 1,2,3, say pretend that these are telephone number, which is one feild in user table. I need to update this telephone number field, I got 3 user ID in series like this too, ie: 3,4,5 and normally it is like update set where userID IN (3,4,5) ( when there is one vaule to update, not series of string to update). I would think about the general layout of the DB. It is not good to store more than one value in one field. Do some normalisation on your DB or read: http://www.devshed.com/Server_Side/MySQL/Normal/ and http://www.devshed.com/Server_Side/MySQL/Normal2/ hope it helps Johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Update statement sent by PHP to MySQL
Hi there, I am trying to update a row in my MySQL database (I am an newbie) It does not work, but the DB does not return an error. Is there an error in the syntax?? // Create the user record //-- -- if (!($newresult = mysql_db_query($DB, update $T1 set caption = $caption where name = $name ))) { HEADER(Location:admin.php?content=edit_dataentryerrormsg=baduserrecord); } //-- -- Thanx for your help Cheers Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Update statement sent by PHP to MySQL
Hi, update $T1 set caption = $caption where name = $name put single quotes aroud the variables: caption='$caption'. You can do this aswell: $result = mysql_query(UPDATE $T1 SET caption='$caption WHERE name='$name', $DB) or die(mysql_error()); if (! $result) { send the haeder... } hope it helps Johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] update statement
I got a series of string value in this format ie: 1,2,3, say pretend that these are telephone number, which is one feild in user table. I need to update this telephone number field, I got 3 user ID in series like this too, ie: 3,4,5 and normally it is like update set where userID IN (3,4,5) ( when there is one vaule to update, not series of string to update). How do I do that with this case then? cheers Jack [EMAIL PROTECTED] There is nothing more rewarding than reaching the goal you set for yourself
[PHP] Update statement?
hey i'm working on a shopping cart..but have hit a snag whit this statement.. function modify_quantity($table, $session, $itemid, $quantity) { $sql = UPDATE $table SET quantity='$quantity' WHERE session='$session' AND itemid='$itemid'; mysql_query($sql); } if there is a value in the db field quantity then after the statement is executed it is set to 0 here is my calling code. if ($action == uq || $action == Update ){ modify_quantity($table,$session,$itemid,$quanity); } and the requested url. http://www.harborfresh.com/retail/cart.php?itemid=21591quantity=5action=Update any ideas? ~kurth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Update statement?
Kurth Bemis [EMAIL PROTECTED] wrote: function modify_quantity($table, $session, $itemid, $quantity) { $sql = UPDATE $table SET quantity='$quantity' WHERE session='$session' AND itemid='$itemid'; mysql_query($sql); Add 'echo $sql;' here (no quotes) and look at the output. If the RHS of quantity= is zero, then $quantity passed to modify_quantity is zero and that's the problem. if there is a value in the db field quantity then after the statement is executed it is set to 0 I think that $quantity is the problem. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Update statement?:SOLVED
At 01:03 PM 4/30/2001, Steve Werby wrote: I hate the letter i :-) it was missing when i passed quantity to the function ~kurth Kurth Bemis [EMAIL PROTECTED] wrote: function modify_quantity($table, $session, $itemid, $quantity) { $sql = UPDATE $table SET quantity='$quantity' WHERE session='$session' AND itemid='$itemid'; mysql_query($sql); Add 'echo $sql;' here (no quotes) and look at the output. If the RHS of quantity= is zero, then $quantity passed to modify_quantity is zero and that's the problem. if there is a value in the db field quantity then after the statement is executed it is set to 0 I think that $quantity is the problem. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]