Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.