Gente,
No puedo lograr escribir correctamente en un archivo PHP un codigo PHP.
Ej:
$datosar = "archivo.php";
$ar=fopen("$datosar","w+");
fputs($ar,"<?include(conex.php);");
fputs($ar,"$sql = 'select * from usuarios where tema = juan';");
fputs($ar,"$result = mysql_query($sql);");
fputs($ar,"if($row = mysql_fetch_array($result))");
fputs($ar,"{");
fputs($ar,"$sql = 'update temario SET leccion = 1 where tema = juan';");
fputs($ar,"mysql_query($sql);");
fputs($ar,"};");
fclose($datosar);
Si alguien me ayuda, estaria MAS que agradecido.
El resultado final del archivo PHP, no me queda como quiero. Por ende, no se ejecuta.