mysql database edited in phpmyadmin does not return query in php script -
this weird problem. have field called status in database table called parents. via php script, entered bunch of parents status of 'active'. later, used phpmyadmin change 2 of them status of 'dormant'. when run query asking rows status of active, in both phpmyadmin , in php script. when run query asking rows status of dormant, phpmyadmin returns 2 rows status dormant, php script not return rows. here relevant pieces of code:
// value of radio button $active $active = stripslashes(strip_tags($_post['active'])); if (!$active) { $active = 'active'; } // similar process value of $myorderby, // can have value of 'name' or 'email' , works fine $query = "select parents.parentid, parents.parentname, parents.parentemail, students.nickname, students.lname parents, students parents.parentid=students.parentid , parents.status=:active order $myorderby asc" ; $stmt = $db->prepare($query); $stmt->bindvalue(':active', $active, pdo::param_str); try { $stmt->execute(); $affected_rows = $stmt->rowcount(); if ($affected_rows > 0) { // various actions... } } catch (pdoexception $ex) { $message = $ex->getmessage() ; $filename = 'admin-parents' ; notifyme($message, $filename) ; } curiously, however, if again use phpmyadmin change 2 rows status 'dormant' status of 'active' (not using punctuation in input box) 2 rows not show in php results active parents. problem started me on entire quest.
clarification: myphpadmin query returns correct result these 2 rows, both when status 'active' , when status 'dormant'. (i change them via myphpadmin.) however, php script never returns these 2 rows, regardless of status.
you need set button selected user, use result parameter in query assuming radio buttons set as
<input type = 'radio' name ='active' value= 'active'>active <input type = 'radio' name ='active' value= 'dormant'>dormant // value of radio button $active $active = $_post['active']; } etc.............. assign parameters
$stmt->bindvalue(':active', $active, pdo::param_str);
Comments
Post a Comment