java - Using Select and Update in PHP query -
i new php .. anyway have application require provide vacation information database supervisor , allow supervisor enter approval of vacation ,
to this, use 2 php pages:
- one retrieve employee vacation request information
- and other insert supervisor approval database
i want application insert approval value in record of employeeid retrieve information in application.
the retrieval of employee information done correctly, insert doesn't work !
i try query didn't work (it didn't return results when exceute query):
<?php if(! $conn) { die('could not connect: '.mysql_error()); } mysql_select_db("a2202757_ourdata",$conn); $flag['code']=0; if($r = mysql_query ("update request_vacation set vacationapprove='".$_post['approval']."' idemployee=$id",$conn)); { $flag['code']=1; } print(json_encode($flag)); mysql_close($conn); ?> what problem ?
what happens assign variable ( = assignment comparison use == or ===) in if statement.
when want check , assign @ same time use this:
if(false !== $r = $mysql_query("update .......") { echo 'update successfull'; } else { echo 'update failed error ' . mysql_error(); }
Comments
Post a Comment