I’m trying to extract a full name from a field in a table, explode it into a two element variable and then insert it into first name/last name fields in the table.
I’m using some code which is giving me an error because my two word string is in a variable and explode thinks it is only one argument when it expects two. Can anyone help me figure out how to do this?
Thanks,
–Kenoli
require '__classes/Db.php';
$sql = "SELECT name FROM tbl_persons";
$stmt = $pdo->query($sql);
$row = $stmt->fetchall(PDO::FETCH_ASSOC);
foreach ($row as $name) {
$names = explode($name['name']);
}