nothing4me Posted July 6, 2008 Share Posted July 6, 2008 Ok, I'm trying to make a script that will make another script that has configuration information. For example: <?php $File = "config.php"; $Handle = fopen($File, 'a'); $Data = "<?php $host['naam'] = '*****'; // my host $host['gebruikersnaam'] = '*****'; // my database username $host['wachtwoord'] = '*****'; // my database password $host['databasenaam'] = '*****'; // my database name $db = mysql_pconnect($host['naam'], $host['gebruikersnaam'], $host['wachtwoord']) OR die ('Cant connect to the database'); mysql_select_db($host['databasenaam'], $db);"; fwrite($Handle, $Data); print "Complete!"; fclose($Handle); ?> So it will create config.php and enter that information. I do not want $host['naam'], $host['gebruikersnaam'], $host['wachtwoord'], or $host['databasenaam'] acting as a variable. I want it to simple just enter that as text. But, I want the ***** to act like variables, so when I create one, it'll go there. Any help? Link to comment https://forums.phpfreaks.com/topic/113450-ignore-some-variables-fwrite/ Share on other sites More sharing options...
fanfavorite Posted July 6, 2008 Share Posted July 6, 2008 Anything you don't want to act as PHP code, you need to escape it with a "\" For example: $date = "\$host['naam'] = '".$varname1."'"; Link to comment https://forums.phpfreaks.com/topic/113450-ignore-some-variables-fwrite/#findComment-582938 Share on other sites More sharing options...
nothing4me Posted July 6, 2008 Author Share Posted July 6, 2008 Anything you don't want to act as PHP code, you need to escape it with a "\" For example: $date = "\$host['naam'] = '".$varname1."'"; And surround the variable that supposed to be in it with ".$VARIABLE."? Link to comment https://forums.phpfreaks.com/topic/113450-ignore-some-variables-fwrite/#findComment-582941 Share on other sites More sharing options...
fanfavorite Posted July 6, 2008 Share Posted July 6, 2008 Yes Link to comment https://forums.phpfreaks.com/topic/113450-ignore-some-variables-fwrite/#findComment-582942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.