I've a row from a db :
$row = mysql_fetch_assoc($res);
$row['something'] contains The number is $var
If $var is set to 5 in the php page I want
echo $row['something']; to output - The number is 5
I tried entering The number is {$var} in the db but no luck.
exec cannot be used here I guess.
I know this has been posted many times here - Just dont know what search terms to give.
Thanks
PHP Variable in MySQL db
Moderator: General Moderators
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
eval() gives unexpected T_STRING
str_replace can be used for a particular case but I'll have various variables which I may not know.
I didnt realize there wasnt a method (function) for this. Guess I'll to actually code for this.
Fine. I asked this since $var in a string gets parsed so I was wondering if theres a method for string in db.
So this is the way phpBB and others parse - they have separate user defined function to parse them right ?
str_replace can be used for a particular case but I'll have various variables which I may not know.
I didnt realize there wasnt a method (function) for this. Guess I'll to actually code for this.
Fine. I asked this since $var in a string gets parsed so I was wondering if theres a method for string in db.
So this is the way phpBB and others parse - they have separate user defined function to parse them right ?