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
cheerio
Forum Newbie
Posts: 18 Joined: Sat Aug 13, 2005 4:52 pm
Post
by cheerio » Fri Dec 16, 2005 3:00 pm
Hey, i need help parsing a string that i am receiving from mysql. Here is the code
Code: Select all
$result = mysql_query("SELECT * FROM `content` WHERE name='current' LIMIT 1");
while($row = mysql_fetch_array($result)) {
echo $row['categories'];
}
This is what it should echo, parsed.
Code: Select all
<div id='head'> Tutorials </div>
<div id='content'>
» <a href='$weburl'>Home</a><br>
» <a href='{$weburl}categories/Adobe_Photoshop'>Adobe Photoshop</a><Br>
» <a href='{$weburl}categories/PHP_and_MySQL'>PHP and MySQL</a><Br>
» <a href='{$weburl}categories/Macromedia_Flash'>Macromedia Flash</a><Br>
» <a href='{$weburl}categories/Adobe_Photoshop'>Adobe Photoshop</a><Br>
</div> <div id='bottom'> </div>
I want it to fill in the varialbe $weburl, but PHP doesn't parse it and i don't know how.
BDKR
DevNet Resident
Posts: 1207 Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:
Post
by BDKR » Fri Dec 16, 2005 9:12 pm
cheerio wrote: Hey, i need help parsing a string that i am receiving from mysql. Here is the code
Code: Select all
$result = mysql_query("SELECT * FROM `content` WHERE name='current' LIMIT 1");
while($row = mysql_fetch_array($result)) {
echo $row['categories'];
}
This is what it should echo, parsed.
Code: Select all
<div id='head'> Tutorials </div>
<div id='content'>
» <a href='$weburl'>Home</a><br>
» <a href='{$weburl}categories/Adobe_Photoshop'>Adobe Photoshop</a><Br>
» <a href='{$weburl}categories/PHP_and_MySQL'>PHP and MySQL</a><Br>
» <a href='{$weburl}categories/Macromedia_Flash'>Macromedia Flash</a><Br>
» <a href='{$weburl}categories/Adobe_Photoshop'>Adobe Photoshop</a><Br>
</div> <div id='bottom'> </div>
I want it to fill in the varialbe $weburl, but PHP doesn't parse it and i don't know how.
Code: Select all
» <a href='{<?php echo $weburl; ?>}categories/Adobe_Photoshop'>Adobe Photoshop</a><Br>