If you're on PHP 5, you could do <?php $incfile = 'data.inc'; $incdata = '<?php $host = \'localhost\'; $user = \'root\'; $pwd = \'\'; $db = \'dvd\'; ?>'; file_put_contents($incfile, $incdata); ?> Am 23.04.2008 um 21:01 schrieb Michael Reaves: > Group, > > I am trying to create an include file that contains the info to > connect to a > MySQL database. I need the file look like this; > > <?php > > $host = 'localhost'; > > $user = 'root'; > > $pwd = ''; > > $db = 'dvd'; > > ?> > > Here is my code so far; > > <?php > > $file = "data.inc"; > > $format = "%c%cphp"; > > $first=60; > > $second=63; > > printf($format,$first,$second); > > $information = $information."\$host='$server';\n"; > > $information = $information."\$user='$user';\n"; > > $information = $information."\$pwd='$pwd';\n"; > > $information = $information."\$dv='$db';\n"; > > echo $information; > > $fw = fopen($file,"w+") or die("Can't open file $file"); > > $fout = fwrite($fw,$information); > > fclose($fw); > > ?> > > I have tried char and printf. When I run this the <?php must be > interpreted > as a new php file and nothing is output. > > Any suggestions will be appreciated. > > Michael J. Reaves, MS, MCP > > Project Specialist > > [Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed]