Hello. Quick easy question I think? I display a INT value to a page (php) by
querying mysql. I want to be able for someone to put a new number and add to
that record. How would I go about doing this. Would this be a mysql command
or a php thing? Thanks in advance.
, May 25, 2004 7:04 PM
Subject: Adding to a record
Hello. Quick easy question I think? I display a INT value to a page (php)
by
querying mysql. I want to be able for someone to put a new number and add
to
that record. How would I go about doing this. Would this be a mysql
command
or a php thing
Seems like you could do it either way:
PHP
?
$new_num = $mysql_num + $user_num;
mysql_query(update table set number = $new_num where . . .)
?
or
MySQL
?
mysql_query(update table set number = number + $user_num where...)
?
Depends if you want php or mysql to perform the calculation.
Daniel
CREATE TABLE tbllayer (
LayerID int(11) NOT NULL default '0',
LayerSize int(11) NOT NULL default '0',
IceTypeID int(11) NOT NULL default '0',
Fingerprint char(16) binary default NULL,
PRIMARY KEY (LayerID),
UNIQUE KEY Fingerprint (Fingerprint),
KEY IceTypeID (IceTypeID)
)
I am looking to update a record in a table, but take the exsisting value and
adding the new value to it...
I.e.
Exsisting record = 150, new record being inputed = 250 for a total of 400 to
be entered into the database.
I have looked at the man pages on this but all it gives is static numbers,
I am looking to update a record in a table, but take the
exsisting value and adding the new value to it...
I.e.
Exsisting record = 150, new record being inputed = 250 for a
total of 400 to be entered into the database.
UPDATE table SET row = row + 250 WHERE id = #;