Re: conjecate a variable to a string in a function

From: Date: Fri, 09 Mar 2001 21:22:25 +0000
Subject: Re: conjecate a variable to a string in a function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43214@lists.php.net to get a copy of this message
At 1:42 PM -0500 3/9/01, Mike wrote:
Whats wrong with this? $MaxID="select Max($Table.'ID') from $Table";
I assume you want to do: $MaxID="select Max($TableID) from $Table"; as long as you don't have a variable called $TableID that is. if you do then do: $MaxID="select Max(".$Table."ID) from $Table"; the . operator for concat only works when you're not in a stting variable. for example: $var = "Hello ".$user; you could also just do: $var = "Hello $user"; PHP is smart enough to notice variables in strings. but periods in strings are just periods. -aaron

« previous php.general (#43214) next »