I want to pass some datas from table to another table when every month starts..
So I tried this method. but I'm getting an error in that pass method.
$date = date('d');
if ($date == 01) {
$sql = "SELECT student_name, payment FROM student_detail";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$sql = "INSERT INTO arrears (student_name, amount) VALUES ('echo $row [student_name]', 'echo $row [payment]')";
}
}
This is an error
Notice: Array to string conversion in C:\xampp\htdocs\table_form\inc\header.php on line 38
But I'm sure that there is an error in this
'echo $row [student_name]', 'echo $row [payment]
and how can I do that?