if ($stmt - > execute()) {
if ($stmt - > rowCount() > 0) {
while ($selected_row = $stmt - > fetch(PDO::FETCH_ASSOC)) {
echo ucwords($selected_row[$name]).
" ";
$basicinfo1[] = $selected_row[$name];
}
$input = array_map("unserialize", array_unique(array_map("serialize", $basicinfo1)));
echo json_encode($input, JSON_UNESCAPED_UNICODE);
//echo $_GET['callback'] . '('.json_encode($basicinfo1).')';
}
}
Echo results in
JEHOMAR MARIA JAMAICA MARIO MARIEGRACE MARIO MARY ANNE MARILYN MARIA CHRISTINA MARIE GRACE MARBIE MARIA JASMIN MARY JANE MARCIANA LEO MARCCO MARGOT MARIA CRISTINA MARIA TERESA MARK ANTHONY MARK ANA MARIE RALPH MARLON MARIANNE JOEMAR MARITES SHIELA MARIE MARIBETH MARIVIC MARIAN MARCELINO ALMEN MARTIN MARK SUNNY MARLOU MARY JANE MARIA RIA ELMAR MARILYN MARGARITA MARIELA MARJORIE ANNE MARTIN MARIONITO JHOMAR MARIA LUISA MARIE KRISTINE MARY ANN MARCELO MARGIE MARIO CHARL-MARI GEMARIE MARIO JOEMAR MARIA LENIE MARILOU MARILOU MARJORIE MARIA PAZ JOSE MARIE MARYCRIS MARVIN MARY FRANCESS JOURIEMAR MARIE Rose MARY JANE ROSEMARIE MARILYN MARIE-MONIQUE MARIANETH MARIBEL MARICEL MARILYN MARK ANTHONY MARVIN LOEWEN MARK MARVEL MARIANO MARTE JOVEMAR MARIBETH MARIVER MARTE MARILOU EDDIMAR MARIO MARISSA MARITES MARLYN MARWIN MARIETTA MARY ANN MARIVI MARYJANE ANNA MARIA EMMAR MARIO MARITES MARK VINCENT MARILYN MARIBEL MARICEL MARISSA MARK ANTHONY MARK KNEP MARK REGGIE
In this code i tried to change the first letter of the names by using ucwords
then followed by the selected row ($selected_row[$name])
but the echo show no change in the names. Still in capital letters. Are there other ways to change words in first letter upper case
Try with -
ucwords
will transform only the first letter but wont take care of the rest. So firststrtolower
to transform it lowercase thenucwords
to transform the first letter uppercase.