Friends, I have a problem with the "... really a headache, I have a php that writes another php code, something like this: Php1 writes content in a file called file and file must execute a mysql statement with the value of a variable that was in php 1
<?php
$subs_nombre = "Junio";
$miArchivo = fopen("archivo.php", "w");
$php='<?php
consulta1 = "select cp_id from config_camp where cp_nombre = "'.$subs_nombre.'" ";
$consulta1 = mysql_query($consulta1, $link);
?>';
fwrite($miArchivo, $php);
fclose($miArchivo);
?>
The problem is that PHP 2 is written like this
<?php
consulta1 = "select cp_id from config_camp where cp_nombre = "Junio" ";
$consulta1 = mysql_query($consulta1, $link);
?>
And being this way when executing "file.php", php tells me that it is not possible since it has "Then I should go with single quotes", but I can not make June remain as 'June'.
Can someone give me a hand?