I have been cracking my head on this mater in the past couple of days. I am faced with a situaton where i need to write a MySQL equivalent of PHP code to loop through sql select results. The Php code looks like this
$query = "SELECT pubid, author FROM refs";
$sql=$con->prepare($query);
$sql->execute();
$sql->setFetchMode(PDO::FETCH_ASSOC);
while ($row=$sql->fetch()){
$id= $row['pubid'];
$author = $row['author'];
$name = explode('., ', $author);
}
How can one write sql/mysql query that does the same?