0

Hello, I ran into a problem trying to create a file named after a table in the mysql database. The table name is stored in a variable called $tablename, and the filename should thus be, $tablename.php.

for example, a table called guestbook should create a file named guestbook.php.
But using the code below it creates guestbookphp. I don't know how to insert the dot.

Thank you in advance.

<?php
$filename = $tablename.php;

$fp = fopen($filename, 'x');
fwrite($fp, '1');
$data = fread($fp, 512);
echo $data;
fclose($fp);
?>
3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Gerald19
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.