mohamad mohamad mohamad mohamad - 8 months ago 21
PHP Question

update query not work in my code

the update query not working

this query didn't work

i try to print the variable and all variable contain a value

how can i solve this?

form code:

echo"<td data-title='Status'>";
if($percent==0){echo"<form class='form-inline' role='form' action='";?><?php $_PHP_SELF ?><?php echo"' method='post' accept-charset='UTF-8'>
<select id='' name='status' class='form-control input-md'>
<option valur='.$status.'>$status</option>
<option value='Pending'>Pending</option>
<option value='Cancel'>Cancel</option>
</select>"; echo"</td>";echo"<input type='hidden' name='txt_id' value='.$id.'>";
echo"<td>";echo"<input type='submit' name='update' class='btn btn-default' value='Update' />";}else if($percent>=1 && $percent<100){
} else if($percent==100){echo"Done";}echo"</td>";

update code:

$sql=mysqli_query($conn,"UPDATE tbl_project SET db_status='$status' WHERE db_id='$ids'")or die(mysqli_error($conn));


1) First of all try to remove this value='.$id.' it should be

echo"<input type='hidden' name='txt_id' value='$id'>"

beacuse it if your $id = 1; then value = '.$id.' is equal to value = '.1.';

Same thing for first option value

<option valur='.$status.'>$status</option> // this is wrong

use this

<option value='$status'>$status</option> 

2) Second try to echo your query always before running so echo your query

     // echo "UPDATE tbl_project SET db_status='$status' WHERE db_id='$ids'";die; just to  debug

        $sql=mysqli_query($conn,"UPDATE tbl_project SET db_status='$status' WHERE db_id='$ids'") or die(mysqli_error($conn));