Answer the question
In order to leave comments, you need to log in
Why doesn't copy work?
There is a code:
<?php
require 'connect.php';
$sql_select = "SELECT * FROM users WHERE DATEDIFF(blok, NOW()) = 3";
$result = mysql_query($sql_select);
if (!$result) {
return;
}
while ($row = mysql_fetch_assoc($result)) {
mail($row['email'], 'Внимание!!', 'Скоро ваш аккаунт будет заблокирован!', $from);
$file = 'vost.php';
$newfile = "../landing/{$row['login']}/vost.php";
if (!copy($file, $newfile)) ;
}
Answer the question
In order to leave comments, you need to log in
In your condition:
Get the error message using php.net/manual/en/function.error-get-last.php and output or log it somewhere. And it becomes clear what is wrong.
The copy() function does not copy files to non-existent directories.
Before copying the file to the directory, you need to check if there is a directory called $row['login'] and if there is no such directory yet, then create it php.net/manual/ru/function.mkdir.php
And after that use copy( )
The use of the rename() function instead of copy() helped me, who would have thought ..)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question