Jump to content

How to create php files from a script.


Orionsbelter

Recommended Posts

hi i'm trying to create a php file from a script but i dont seem to be getting it right the file doesn't exist already am trying to create it.

 

<title>test</title> <?php 
include_once"includes/db_connect.php";

$sql=mysql_query("SELECT `urlName` FROM `products` WHERE `category`='1'");
while($fetch=mysql_fetch_object($sql)){
$File = "".$fetch->urlName.".php"; 
$handle = fopen($File, 'w');
fclose($handle);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/249423-how-to-create-php-files-from-a-script/
Share on other sites

Forget the idea. You have the wrong solution to your problem.

 

Look into something called URL rewriting instead. It's a process that turns URLs like "big-blue-chair.php" into ones like "showproduct.php?product=big-blue-chair". No silly nonsense of creating PHP actual files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.