formula in subtracting a formula in php with mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chemz
    New Member
    • Feb 2008
    • 3

    formula in subtracting a formula in php with mysql

    hi all, i have problem in creating a formula of my code. this is all about updating a mysql database in including it in php. I dont know how to generate it. can you please give me some code in a working php with mysql.

    This code is to update after clicking the word update and to subtract each time to click by once..

    Please help me..

    Sample code:
    "SELECT * FROM tablename WHERE time = 20";
    $time1 = time -1 ;
    "UPDATE tablename SET time = $time1";

    Is this correct?

    What else would i add to make my code complete in updating my mysql database?
  • Nadeem0319
    New Member
    • Feb 2008
    • 5

    #2
    Originally posted by chemz
    hi all, i have problem in creating a formula of my code. this is all about updating a mysql database in including it in php. I dont know how to generate it. can you please give me some code in a working php with mysql.

    This code is to update after clicking the word update and to subtract each time to click by once..

    Please help me..

    Sample code:
    "SELECT * FROM tablename WHERE time = 20";
    $time1 = time -1 ;
    "UPDATE tablename SET time = $time1";

    Is this correct?

    What else would i add to make my code complete in updating my mysql database?
    that would be something like this if i understood what you mean:

    [PHP]
    <?php
    if($_GET['update'] == 1) {
    $sql = mysql_query("UP DATE `tablename` SET time='".$time1. "'");
    if(!$sql){die ("Error: ".mysql_error() ."");}
    echo "Update successful!";
    }

    echo "<a href=\"?update= 1\">Update!</a>";
    ?>
    [/PHP]

    Comment

    Working...