开发者

How can i echo a variable like this from db?

kHow can i echo $tags like this:

<video:tag>tag1</video:tag><video:tag>tag2</video:tag><video:tag>tag3</video:tag><video:tag>tag4</video:tag>

inside the $string?

$sql = dbquery("SELECT id,tags FROM videos WHERE views > 4 ORDER BY id DESC LIMIT 0,10");

while($row = mysql_fetch_array($sql)){
    $new_id = $row["id"];       
    $tags = $row["tags"];    

   // other code for the other variables //

    $string .='
    <url>
    <loc>'.$url.'</loc>
    <video:video>
    <video:thumbnail_loc>'.$vimg.'</video:thumbnail_loc>
    <video:title>'.$new_title.'</video:title>
    <video:description>'.$new_description.'</video:description>
    <video:content_loc>'.$video_path.'</video:content_loc>
    <video:player_loc allow_embed="yes" autoplay="ap=1">'.$video_path.'</video:player_loc>
    <video:duration>'.$duration.'</video:duration>
    <video:rating>'.$rating.'</video:rating>
    <video:view_count>'.$views.'</video:view_count>
    <video:publication_date>'.$date_added.'&开发者_Python百科lt;/video:publication_date>


    // how can i echo $tags from db like this?  //

    <video:tag>tag1</video:tag><video:tag>tag2</video:tag><video:tag>tag3</video:tag><video:tag>tag4</video:tag>

    <video:category>'.$category.'</video:category>
    <video:family_friendly>yes</video:family_friendly>
    <video:requires_subscription>no</video:requires_subscription>
    <video:uploader info="'.$embed_url.'user.php?id='.$new_id.'">'.$user.'</video:uploader>
    </video:video>
    </url>';}

$string .='</urlset>';


echo $string;

In the database, in tags row the tags are like

tag1, tag2, tag3, tag4


$tagString = '<video:tag>'.implode('</video:tag><video:tag>', explode(",", $tags)).'</video:tag>';

And then in your $string:

$string .= 'blablabla </publication_date> '.$tagString.'<video:category> blabla';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜