Re: Pear Auth and SQL
| From: | Kancha | Date: | Sun, 09 Dec 2001 03:36:09 +0000 |
| Subject: | Re: Pear Auth and SQL | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-588@lists.php.net to get a copy of this message | ||
Simon H wrote:
Can anyone explain to me why this wont work, or if there is another way to use the (logged on) users Username in a query: $UserDetailsSQL = 'SELECT * FROM users WHERE UserID = $a->getUsername()';
$UserDetailsSQL = "SELECT * FROM users WHERE UserID = '$a->getUserName()'";when you have a variabable inside a single quote the variable is not evaluated. Eg: $s = '$x' and $s="$x" are different. The first one will print $x while the other one will print the value of $x. example: $x=2; $s="$x"; echo $s; will output 2 $x=2; $s='$x'; echo $s; will output $x. kancha.