View Single Post
  #3 (permalink)  
Old 10-30-03, 02:22 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
your code is good ..
PHP Code:

<?php 

$number
=$_POST['number'];//get the number from POST
settype($number"integer");//make sure it's a number not a string ..
$conn mysql_connect("localhost""user""pass"); 
mysql_select_db("DB",$conn); 
$sql "INSERT INTO Table values ('', number=number-$number)";
/*notice that you don't need any quote here just call 'number' from database
and use it again in the same query and substract
$number from it .. ot use any other algebra ..*/
if (mysql_query($sql$conn)) { 
     echo 
"record added!"
} else { 
    echo 
"something went wrong"

?>
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote