Jump to content

[SOLVED] Very Quick Question


Shaun13

Recommended Posts

I am creating an install script for people to use my software. Heres the problem:

 

Here is the part of the script we are lookign at:

 

	$file1 = fopen("mysql_info.php","w");
		echo fwrite($file1,"
		<?php 
		// ===========================
		// whats my database info?
		// ===========================
		$host2=".$host1."; // Host name 
		$username2=".$username1."; // Mysql username 
		$password2=".$password1."; // Mysql password 
		$db_name2=".$database1."; // Database name 

		 ?>");
		fclose($file1);

 

Ok, heres the problem. It is thinking that $host2, $username2, etc.. are variables I have set, and obviously on mysql_info.php, all I end up with is:

 

<?php 
		// ===========================
		// whats my database info?
		// ===========================
		=somehost; // Host name 
		=someusername; // Mysql username 
		=someonespassword; // Mysql password 
		=someonesdatabasename; // Database name 

		 ?>

 

 

Any Help?

 

~Shaun

 

Link to comment
https://forums.phpfreaks.com/topic/54658-solved-very-quick-question/
Share on other sites

	$file1 = fopen("mysql_info.php","w");
		echo fwrite($file1,'
		<?php 
		// ===========================
		// whats my database info?
		// ===========================
		$host2='.$host1.'; // Host name 
		$username2='.$username1.'; // Mysql username 
		$password2='.$password1.'; // Mysql password 
		$db_name2='.$database1.'; // Database name 

		 ?>');
		fclose($file1);

$file1 = fopen("mysql_info.php","w");
		echo fwrite($file1,'
		<?php 
		// ===========================
		// whats my database info?
		// ===========================
		$host2='.$host1.'; // Host name 
		$username2='.$username1.'; // Mysql username 
		$password2='.$password1.'; // Mysql password 
		$db_name2='.$database1.'; // Database name 

		 ?>');
		fclose($file1);

 

Use single quotes, it takes $ as being literal and does not interpret it.

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.