使用当前内容PHP + MySQL进行更新

I need to add Data to the Data that is already in the table.What i need to know is how to Add but i dont want to get the Data,manipulate it(Add) and then update.

Like Data= Data+NewData

You don't need to get the data in the row before updating, just update the column that you need to.

http://www.w3schools.com/php/php_mysql_update.asp

With UPDATE, use the CONCAT MySQL function described here.

Example:

UPDATE table SET row = concat(row,'data to add') WHERE …

If I understand correctly you need a way to execute an sql statement that UPDATE or INSERT data in one statement.

You could use REPLACE INTO or ON DUPLICATE KEY in your statement:

REPLACE INTO FOO(ID,BAR) VALUES('1','BAR')

OR

INSERT INTO FOO (ID, BAR) VALUES(1,'BAR1'),(3,'BAR2') ON DUPLICATE KEY UPDATE BAR=VALUES(BAR)

Well, first you have to connect. Youre question is not clear so, here '$'

<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

and if you mean the content you want is already on that page, you can do this mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB");

<?
$sql="select * FROM `clients` where id = '".$id."' ORDER BY `id` DESC  LIMIT 50;";
$row=mysql_query($sql) or die(mysql_error());
?> 
<?php 
while ($row = mysql_fetch_assoc($row)) { 
?> 

       <h3> ID:</h3> <? echo $row["id"]; ?>
         <hr>
         <hr>
         <h3> Date and time: </h3> <? echo $row["dt"]; ?>
         <hr>
         <h3> Name: </h3> <? echo $row["name"]; ?>
         <hr>
        <h3> Contact: </h3>   <? echo $row["contact"]; ?>
         <hr>
        <h3> Notes:  </h3>   <? echo $row["note"]; ?>
         <hr>
     <h3>    Our Comment:   </h3>    <? echo $row["comment"]; ?>
            <hr>
            <h3>Contacted:</h3>
            <?
            $boolval = $row["called"];
            if ($boolval == 1)
            {echo "Customer has been called";}
            else
            {echo "Customer has not been called";}


            ?>

<?php 

}; 
?> 

Hoe this helps

It sounds like what you want is a database model to do something like this:

$Model = db_table::fetch_by_id($id);

$Model->Name = 'new name';

$Model->update();

I've used custom database models to do this before, but I don't know of anything native to PHP that supports that.

Under the hood it's essentially doing this:

SELECT * FROM Google.Users WHERE id = '23';

//Your php business logic here\\

UPDATE Google.Users SET name='new name' WHERE id='23';

Okay, so if you want to append something this is how you do it. For Strings ie text;

<?php
$a = "Hello ";
$b = $a . "World!"; // now $b contains "Hello World!"

$a = "Hello ";
$a .= "World!";     // now $a contains "Hello World!"
?>

For numbers, say you have 2 as current value, and 4 is the new value

<?php
$current=2;
$new=4;
$current += $new; // now current is 6 as we added the 4 to it. 
?>

To add it to your Data base, you simply insert it

INSERT INTO TABLE (ID) VALUES($current);
//OR if you're form posts and/or gets to your php page.
$sql="INSERT INTO Tabel (new number, current number)
VALUES
('$_POST[numbernew]','$_POST[numberold]')";