php - UPDATE not working as intended -


i have 2 statements here, , insert , update. insert works fine. update statement seems nothing.(i.e. homecode column remains null) , when try print stmt object, says 0 rows affected.

function insert_each_cell($row_count,$gradunit, $lastname, $firstname,$initials,$scititle,                 $appointstart,$appointend,$suplevel,$restrictions,$primary,$primgrad,                 $grad1,$grad2,$grad3,$homeabbrev,$homecode,$homename,$univstartdate                 ,$univenddate){     global $conn;      //insert strings     $prep = $conn->prepare("insert sgs_student_info (gradunit, lastname, firstname, initials, scititle, restrictions,primgrad, grad1, grad2,grad3, homeabbrev, homename)         values (?,?,?,?,?,?,?,?,?,?,?,?)");     $prep-> bind_param("ssssssssssss",$gradunit, $lastname, $firstname,$initials, $scititle, $restrictions,$primgrad, $grad1, $grad2,$grad3, $homeabbrev, $homename);     $prep-> execute();     $prep -> close();     $prep = $conn->prepare("update sgs_student_info set homecode=? id=?");     echo $homecode. "<br>" . $row_count . "<br>";     $prep->bind_param("ii", $homecode, $row_count);     print_r($prep);     echo "<br>";     $prep->execute(); 

}

i fixed problem

it due $row_count being 1 more row i'm on. row haven't been created yet, that's why update doesn't anything


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -