Advertisement

02.21.2007 at 03:16AM PST, ID: 22403092
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.2

mysql to print php output file

Asked by peter2001 in PHP and Databases

Tags: , , ,

Hi
i have a rss feed that i want to output like this in a php file so when i go to the say video.php
it will print this in the browser (without the commented bits)





<ratings>
<video file="www.mysite/vids/11.flv">                                       // i'll add this manually for now in the php file
<title>funny Commercials - Ikea - </title>                                   // $description = $results['description'];
<runtime>00:30</runtime>                                                   // i'll add this manually for now
<author>silent</author>                                                           // .$results[username].
<rating>5</rating>                                                                 // I'll add maually for now in the php file
<views>20</views>                                                                   // i'll add this manually for now in the php file
<key>aa6e02c990b0a82652dc</key>                                        // .$results['vkey'];
<link>testtest</link>       //  $video      =$config['BASE_URL']."/view_video.php?viewkey=".$results['vkey'];
</video>
<video file="10.flv">
<title>funny Commercials - Ikea - Balls</title>
<runtime>00:32</runtime>
<author>test</author>
<rating>5</rating>
<views>22</views>
<key>44259755d38e6d163e82</key>
<link>testtest</link>
</ratings>








I have been tring for sometime and having no look in making it work
below is the rss.php i am tring to convert to make it print out like above most of the info i need is there i'll add the bit maually till i find the
right tables for the other info

could someone help me try and make a sample if only to make the php print out the author and the title just as a guide to get me going




<?php

include("include/dbconfig.php");
include("include/config.php");

if ($_GET[type] == "new")
{
  $query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.VID desc LIMIT 10";
  $titel = "[20 Newest videos on ".$config['site_name']."]";
  $url   = $config['BASE_URL']."";
}
elseif ($_GET[type] == "views")
{
  $query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.viewnumber desc LIMIT 10";
  $titel = "[20 Most Viewed videos on ".$config['site_name']."]";
  $url   = $config['BASE_URL']."";
}
elseif ($_GET[type] == "comments")
{
  $query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.com_num desc LIMIT 10";
  $titel = "[20 Most Commented videos on ".$config['site_name']."]";
  $url   = $config['BASE_URL']."";
}

else
{
  $query = "SELECT A.*,B.UID,B.username FROM media A, signup B WHERE A.UID=B.UID AND A.type = 'public' ORDER BY A.VID desc LIMIT 20";
  $titel = "[20 Newest videos on ".$config['site_name']."]";
  $url   = $config['BASE_URL']."";
}


header("Content-Type: text/xml");
header("Expires: 0");
print "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
print "<!DOCTYPE rss >\n";
print "<rss version=\"2.0\" xmlns:prc=\"http://purl.org/dc/elements/1.1\">\n";
print "<channel>\n";
print "<title>".$config['site_name']."</title>\n";
print "<link>".$url."</link>\n";
print "<description>".$titel."</description>\n";
print "<copyright>Copyright (c) 2006-2007 by ".$config['site_name']." - All rights reserved.</copyright>\n";
print "<image>\n";
print "<url>".$config['BASE_URL']."/images/11.jpg</url>\n";
print "<title>".$config['site_name']."</title>\n";
print "<link>".$config['BASE_URL']."</link>\n";
print "</image>\n";
 
$db=mysql_connect ($DBHOST,$DBUSER,$DBPASSWORD) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ($DBNAME);
 
$num_rows = mysql_num_rows(mysql_query("select * from media"));
 
$result = mysql_query($query) or die ('Query Error: ' . mysql_error());
while ($results = mysql_fetch_array($result))
{
  $photo       = $config['BASE_URL']."/thumb/1_".$results['VID'].".jpg";
  $video       = $config['BASE_URL']."/view_video.php?viewkey=".$results['vkey'];
  $description = $results['description'];
  $description = str_replace ("&amp","",htmlspecialchars(stripslashes($description)));
  $photo       = str_replace ("&amp","&amp",htmlspecialchars(stripslashes($photo)));


print "<item>\n";

print "  <title>".$results['title']."</title>\n";

print "  <description>\n";

print "    <![CDATA[";

print "<img src=\"$photo\" align=\"right\" border=\"0\" width=\"174\" height=\"130\" vspace=\"4\" hspace=\"4\" />

 

       

".$description."</p>

".$key."</p>

       

Added by: <a href=\"$config[BASE_URL]/uprofile.php?UID=".$results[UID]."\">".$results[username]."</a>
 

       Tags: ";



  $tok = strtok($results[keyword], " ");

  while ($tok !== false)

  {

    print "<a href=\"$config[BASE_URL]/search_result.php?search_id=".$tok."\">".$tok."</a> ";

    $tok = strtok(" ");

  }

print "
Date: ".$results[adddate]."
</p>
<hr>";

print "    ]]>\n";



print "  </description>\n";


print "</item>\n";





}

mysql_close();

print "</channel>";

print "</rss>";

?>


regards

peteStart Free Trial
[+][-]02.21.2007 at 10:29AM PST, ID: 18580740

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.21.2007 at 03:12PM PST, ID: 18583145

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.21.2007 at 04:25PM PST, ID: 18583483

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.22.2007 at 02:21AM PST, ID: 18586162

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.22.2007 at 02:33AM PST, ID: 18586236

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.22.2007 at 11:03AM PST, ID: 18590392

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.25.2007 at 04:51PM PST, ID: 18606733

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.09.2007 at 10:03AM PDT, ID: 19663833

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08.13.2007 at 04:13AM PDT, ID: 19682805

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP and Databases
Tags: php, cdata, feed, print
Sign Up Now!
Solution Provided By: Vee_Mod
Participating Experts: 2
Solution Grade: B
 
 
 
Loading Advertisement...
20081112-EE-VQP-44