php update statement ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • impin
    New Member
    • Jul 2010
    • 127

    php update statement ?

    want to update uae....
    whats wrong in this code...

    Table

    Code:
    table q1
    
    	q1	uae	tunisia	palestine	lebanon
    	1	1

    Code:
    $sql="SELECT * FROM q1";
    $result=mysql_query($sql);
    
    	$uae=$uae+1;
    
    $update="update q1 SET uae='$uae' where q1='1'";
    	$result1 = mysql_query($update);
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You never pull uae from the query. It's not set to anything when you add 1 to it. Besides, if all you need is to add one to the existing value, there's no need to read it first. Just add one to the field directly.

    Comment

    Working...