Jump to content

Minus 1


june_c21

Recommended Posts

hi , i want  to select qty from master where id=$id , then i want to minus the qty = qty -1  and update in the query .

here is my code . can tell me what went wrong ?

 

$query= "SELECT qty FROM master where id=$id";
$result = mysql_query($query,$dblink);
  while($myrow = mysql_fetch_row($result))
  {
qty -= 1;

  $query = "UPDATE master SET qty='$qty' WHERE id= $id";
$result = mysql_query($query,$dblink);

  }

 

thanks

 

Link to comment
https://forums.phpfreaks.com/topic/221751-minus-1/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.