I am trying to make a new .php file using php. But I get the following error:
error : Notice: Undefined variable: conn in C:\xampp\htdocs\create\index.php on line 4.
Here is the sample code :
<?php
    $myfile = fopen("koneksi.php", "w") or die("Unable to open file!");
    $txt = "<?php $conn=mysqli_connect('localhost', 'root', '', 'crm');
                  date_default_timezone_set('Asia/Jakarta'); 
           ?>";
    fwrite($myfile, $txt);
    fclose($myfile);
?> 
 
     
     
    