echo a variable inside a varibale?

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
jasondavis
Forum Commoner
Posts: 60
Joined: Sat Feb 04, 2006 5:35 pm

echo a variable inside a varibale?

Post by jasondavis »

Ok Im making a small script for an FAQ section on my site
basicly this is my code that displays my Answers on my page from a mysql DB

Code: Select all

" . $row['answer'] . "

when I add new entries in the DB to be showed sometimes I need to display some php code for instance I tried this and it just acts like it isnt there when I view my page

Code: Select all

<?echo=$users_in_train;?>
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Try:

Code: Select all

<?php echo $users_in_train; ?>
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

if you want to use the echo shortcut, do this

Code: Select all

<?=$var; ?>
But your php settings must allow short tags to be used because I don't think <?php=$var; ?> works.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply