RE: [PHP] Two easy questions I think..

From: Date: Fri, 13 Feb 2004 10:25:00 +0000
Subject: RE: [PHP] Two easy questions I think..
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-177584@lists.php.net to get a copy of this message
Sum() and auto_increment Why not read the mysql manual? -----Original Message----- From: Radwan Aladdin [mailto:raladin@emirates.net.ae] Sent: vrijdag 13 februari 2004 11:14 To: php-general@lists.php.net Subject: [PHP] Two easy questions I think.. Hi.. 1- In my mySQL DB there is a field named "Whole".. there are many rows.. and every one has the value for the field "Whole". What I want is to add all these values in all rows for the field "Whole" then show it on the screen.. I mean by add : 1 + 2 + 3 = 6... 2- I have another filed there also.. named "UserNo" I want every adding query to this field to include a value in the row for that field = the latest row's value + 1 For example : if there are three rows in the table.. Row1 : "UserNo" value = 1 Row2 : "UserNo" value = 2 Row3 : "UserNo" value = 3 I want PHP to get the last row's value for that field (In this example : 3) then add to it 1.. so it will be 4 and insert it to the new row.. Regards..

« previous php.general (#177584) next »