create a php file with fwrite
Posted: Sat Oct 30, 2004 8:40 am
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
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 :/
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ї'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)){
$$sname=$$arow;
}
echo 'Hello, this is $$sname text!';
?>");
fclose($fp);
?>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 :/