Re: Odd question regarding creating a php file

From: Date: Wed, 07 Feb 2001 04:40:04 +0000
Subject: Re: Odd question regarding creating a php file
Groups: php.general 
Request: Send a blank email to php-general+get-38491@lists.php.net to get a copy of this message
"Dusten" <dusten@gofrontline.com> wrote: > fwrite($fp, "<?php > $result = mysql_query("SELECT * from winLoss WHERE > login='$login' AND pass='$pass'"); > ?> > Ive ommited the redundant things. Basicly it just creates this: SELECT * > from winLoss WHERE login='' I need that value in there. Any ideas? When you enclose variables (as represented by $ followed by variable name) within double quotes the content found within the double quotes are parsed and translated into their value counterparts. When you enclose variables within single quotes the variables remain intact as variables. So if you want to pass the SQL statement with the variables intact enclose in single quotes. If your problem is simply that the variables are translating to empty values, you need to do some debugging. At the same point in the code put: echo "login: $login, pass: $pass"; If the values don't appear then they're not available to the code. It might be something as simple as you having the code within a function and the variables being set outside the function in which case you should refer to them as $GLOBALS[login] or $HTTP_POST_VARS[login] or $HTTP_GET_VARS[login] or whatever's appropriate for your application. -- Steve Werby COO 24-7 Computer Services, LLC Tel: 804.817.2470 http://www.247computing.com/

« previous php.general (#38491) next »