Lifelesspeople.com

 Forum FAQsForum FAQs  Knowledge BaseKnowledge Base  RulesRules   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   HostingHosting   RegisterRegister 
 DonateDonate   WikiWiki   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Inserting variables in strings in PHP

 
Lifelesspeople.com Forum Index -> Web Architects' Abode
Post new topic   Reply to topic View previous topic :: View next topic  
Author Message
Scott
tutorialtoday.com


Joined: 24 Mar 2005
Posts: 2627
Location: Mississauga, Ontario

PostPosted: Tue Feb 12, 2008 6:14 pm    Post subject: Inserting variables in strings in PHP Reply with quote

I released a script for upgrading the version of a script which people downloaded. In the upgrade it inserted a template (which consists of HTML and variables) into MySQL. I tested it and it worked fine for me but for a few people, when they upgraded and used the template, the spot where the variables would be were now blank.

So I am guessing the problem was probably that PHP tried to parse those variables when inserting it, even though they were inside a string. I searched around and I found in a comment on php.net that a variable in double quotes will be parsed, a variable in single quotes will not be and an escaped (\ before $) will not be parsed.

Which proved to be true after I doing so on this host's PHP 5 and 4. Although, the thing is, the upgrade script did have the values wrapped in single quotes, yet some people still had problems, could there be a PHP setting or a certain version that could be causing this?

Then again this might not even be the problem, I can't really tell because I don't have any on this host.
_________________
Tutorial Management Script - Version 1.4 Released
TutorialToday - Up and running, submit your tutorials!
Linux Tutorials - Coming Soon
Back to top
 
krt
...


Joined: 11 Jan 2005
Posts: 4695
Location: Down Under

PostPosted: Wed Feb 13, 2008 6:12 am    Post subject: Reply with quote

Sorry, I'm confused. Why is the database involved?

Are you trying to do something like a patch file, e.g.

- some obsolete line
- some obsolete line
+ new line
+ new line

@ reference line(s)
+ new line
+ new line

For reference:

'literal $variable in single quotes'
"literal \$variable in double quotes"

There is no setting that would allow variables in single quotes to be parsed as such. I'd say callbacks and evaluated code is not relevant here so I have no idea what would be causing the problems mentioned.
Back to top
 
Scott
tutorialtoday.com


Joined: 24 Mar 2005
Posts: 2627
Location: Mississauga, Ontario

PostPosted: Wed Feb 13, 2008 6:49 am    Post subject: Reply with quote

The HTML and CSS are stored in the database for easy editing, it is a styling system similar to vBulletin where you have templates which show in certains spots on certain pages, and there are variables which are parsed by the script to make the templates dynamic.
_________________
Tutorial Management Script - Version 1.4 Released
TutorialToday - Up and running, submit your tutorials!
Linux Tutorials - Coming Soon
Back to top
 
Display posts from previous:   
Post new topic   Reply to topic    Lifelesspeople.com Forum Index -> Web Architects' Abode All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Home | Hosting | News | Forum | Links | System Status | About | Archive | Donate ]
Powered by phpBB © 2001, 2002 phpBB Group
All trademarks and copyrights on this page are owned by their respective owners. Posts and comments are owned by the poster. Everything else © 2001 - 2007 Lifelesspeople.com