[thelist] writing a variable to file in PHP

Joe Lance JoeL at HUMBOLDTBANK.COM
Tue Jan 7 15:07:01 CST 2003


If you use single quotes php will not try to parse the vars

example
$body  = '<?
         $connect = mysql_connect "ip", "login", "pw");';

-----Original Message-----
From: Tom Dell'Aringa [mailto:pixelmech at yahoo.com]
Sent: Tuesday, January 07, 2003 12:54 PM
To: thelist at lists.evolt.org
Subject: [thelist] writing a variable to file in PHP


Heyo,

I'm dynamically writing a PHP file that has some variables in it. Two
of my opening lines are thus:
---------------------
$body  = "<?\n";
$body .= "$connect = mysql_connect 'ip', 'login', 'pw');\n";
---------------------

When I open my generated file, I only get:

---------------------
 = @mysql_connect('127.0.0.1', 'moshe', 'silvermysql');
---------------------

For some reason it is *I think* trying to write the value of
$connect. How can I avoid this so it gets written out as a variable?
I figured since it was inside the string it would, but then PHP does
parse vars inside a string...help!

Tom


=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list