Welcome Guest, Not a member yet? Register   Sign In
There's a dollar(sign) in variable name
#2

You could try:

PHP Code:
$tmpVar 'prince_in_u$';
echo 
'Price in US: ' $comp_prod->$tmpVar

Or

PHP Code:
echo 'Price in US: ' $comp_prod->{'prince_in_u$'}; 

Another idea would be to fetch the result as an array instead of an object.

PHP Code:
foreach ($query->result_array() as $row)
{
 
  echo 'Price in US: '$row['prince_in_u$'];



Or as a last resort you could change the column name in your database.

PS, in your code you forgot the dot sign to concatenate the string and the object.
Reply


Messages In This Thread
RE: There's a dollar(sign) in variable name - by Diederik - 09-10-2015, 12:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB