New to PHP and have a simple (stupid) variable question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jerrydhawkins
Forum Newbie
Posts: 4
Joined: Fri Feb 19, 2010 9:20 pm

New to PHP and have a simple (stupid) variable question

Post by jerrydhawkins »

I am writing my first application with php (or with any programming language) and I find myself stumped with something that seems very trivial. After writing pages worth of functional but barbaric code I cannot solve this one little problem.

In order to switch templates for my pids, from the index.php I thought that I would just store a portion of the template name in a mysql database which the user selects from a drop down while creating the document, and stick the variable in the include statement to assign the proper template. The problem is that I can easily display the assigned value of other variables within html portion of my site with a <?php echo "{$row['title']}"; ?> or such, however when I try to place the value of $row['template'] within the <php require('templates/($rtemplate).php'); ?> I do not know how to extract the value to complete the path to my template. I tried assigning $row['template'] to $rtemplate to simplify things, and I can echo the results of $rtemplate successfully....

If anyone can tell me how to complete my path, I would be very grateful.....Like every night it seems, I have grown accustomed to staying up all night trying to fix one line of code that is resolved in 5 minutes the next day (after a couple of hours of sleep)....However, even knowing the outcome, I'm sure that I'll be up all night working on this one little detail......Out of curiosity, does that ever go away?

Thanks
jerrydhawkins
Forum Newbie
Posts: 4
Joined: Fri Feb 19, 2010 9:20 pm

Re: New to PHP and have a simple (stupid) variable question

Post by jerrydhawkins »

I figured it out.....I used ' (single quotes) instead of " (double quotes) all is well now. Thanks to anyone who read

require("templates/$rtemplate");

The little crap kills me!
Post Reply