Page 1 of 1

create a php file with fwrite

Posted: Sat Oct 30, 2004 8:40 am
by joachimseitz
what i want to do is create a new php file
f.e.
test.php

the thing is it gets stuff from a mysql db

this is how im trying it

Code: Select all

<?
$user_id="user_id";
$result="result";
$sname="sname";
$arow="row&#1111;'sname']";
$brow="row";
$quote=""";

$pagename="test";
$fp = fopen("$pagename.php", "w");
$fpwrite = fwrite($fp,
"<?
require_once('config.php');

$$user_id=9;
$$result = mysql_query('SELECT * FROM users WHERE id=$$user_id');
while ($$brow = mysql_fetch_array($$result))&#123;
   $$sname=$$arow;
&#125;

echo 'Hello, this is $$sname text!';

?>");
fclose($fp);
?>
i want to got some " in the file cause i cant only work with '
since the query wont work without "

so i need some ideas how to make it work
maybe also even easier ideas than always havin $$xxx

the other problem is that it can't include the config.php since it has other user rights
but this problem isn't essential atm since i can always just have the config in the same file :/

Posted: Sat Oct 30, 2004 9:40 am
by kettle_drum
You can use \" to display a double quote within double quotes.