php - PDO query not executing in while loop -
i tyring use pdo retrieve data database.
i can retrieve 'name' during first iteration not after 2nd iteration.
my code follows:-
while ($row = $stmt->fetch(pdo::fetch_assoc)) { $id = $row["id"]; $query = "select name style_master id=$id"; $stmt = $db->query($query); $style_name = $stmt->fetch(pdo::fetch_assoc)["name"]; echo $style_name; // first id name displayed next id onwards no style name displayed. }
$stmt->fetch(pdo::fetch_assoc)["name"]; ?
$style_name = $stmt2->fetch(pdo::fetch_assoc)["name"];
Comments
Post a Comment