homepage Welcome to WebmasterWorld Guest from 54.211.7.174
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
wordpress echo dollar sign from db
echo dollar sign from db
weddingm




msg:4618266
 2:46 am on Oct 22, 2013 (gmt 0)

Hello,

I am trying to echo $1299 from a database onto a wordpress page. However all I get is 99. I even used single quotes.


echo'.$phone.'
<a href="http://'.$website.'" rel="nofollow">'.$website.'</a>
'.$communication.'';


In the field communication, it echoes 99 for what is in the database as $1299.

Any ideas?

 

Readie




msg:4618406
 5:47 pm on Oct 22, 2013 (gmt 0)

Humm. As far as I'm aware, and indeed in a quick test I just threw together, a dollar in a variable has no bearing on echo.

It's also definitely nothing such as a numeric typecasting, as they use "from-the-first" characters - in this case a $, which results in it being cast to 0.

I'm going to suggest that either:
- You are mistaken about what record is actually being pulled from the database
- You are re-using a variable already set to "99" - and have a spelling error in the second assignment
- You have some debug code that is overwriting your database value within the PHP

tl;dr: there's nothing really wrong with the code sample provided - the problem lies higher up in the script.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved