-1
I’m creating a list of birthday students of the month, using php and mysqli.
I’m not only able to load the birthday students of the current month,;
SELECT * FROM `student` WHERE MONTH(STR_TO_DATE(birthday, '%d/%m/%Y')) = MONTH(NOW())
That returns me correctly the students of the current month:
Already in PHP loads all students!*
Code used:
$students = $this->db->get('student')->result_array();
foreach ($students as $row):
My difficulty is to create the array seeking only birthday students of the month from the student table Birthday field.
What value of arrays?
– Maury Developer
I am using <?php echo date(’d', strtotime(str_replace("/", "-",$Row['Birthday'])); ? > to show only the day.
– Pedro Paulo
Array is loading all students! I’ll add an image.
– Pedro Paulo
@Pedropaulo would not be easier you create a View in the bank and then only display the result on the page ?
– Edvaldo Lucena
Data is a
varchar
at the bank?– rray
@rray, that’s right.
– Pedro Paulo
I have a rather complicated suggestion:
$test = explode("/", $row["birthday"]); if (test[1] == "07") {echo row["birthday"]}

You could validate if it was the current month in php.– Maury Developer
You can do the same query see => https://www.codeigniter.com/user_guide/database/query_builder.html .
– rray
@rray! Good, now I’ll see if I can create Row.
– Pedro Paulo