Jump to content

kirks

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kirks's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The echo command worked but I don't know why. I'm thinking it may be the $getRecord['details_date']; but I'm not sure nor how/what to replace it with. ???
  2. Okay! Yeah, echoing out $sql2 worked.
  3. H-m-m-m, I tried the extra parenthesis but didn't change the results. I also tried the MONTH(details_date) and YEAR(details_date) but output failed altogether. Thanks though.
  4. Yeah, at first, I didn't think the other code mattered, but it obviously does. Here's the entire script that outputs data for input into a flash file: <?php include("itn.globals.php"); include("itn.opendb.php"); $currentDate=date("Y-m-d"); echo ("itncontent="); $query="SELECT distinct(DATE_FORMAT( `details_date` , '%Y' )) AS years from itn_details group by details_date" ; $Res=mysql_query($query, $connection); while($row=mysql_fetch_assoc($Res)) { echo ("<br><br><font size='20' color='#F9D9A3'> " . $row['years'] . " Itinerary</font>"); echo ("<br>\n"); $sql1="SELECT Distinct(DATE_FORMAT( `details_date` , '%M' )) AS Month from itn_details WHERE details_date >='$currentDate' and DATE_FORMAT( `details_date` , '%Y' )='".$row['years']."' group by Month order by details_date"; $Res1=mysql_query($sql1, $connection); while($row1=mysql_fetch_assoc($Res1)) { echo ("<img src='images/hr.png' height='2' width='400' align='left'><br>\n"); echo ("<font size='16' color='#F9D9A3'> " . $row1['Month'] . "</font>"); echo ("<br>\n"); $sql2="SELECT *, DATE_FORMAT(`details_date`, '%M %d') AS start_date, DATE_FORMAT(`details_end_date`, '%d') AS end_date, DATE_FORMAT(`details_date`, '%Y') AS start_year FROM itn_details WHERE (details_end_date IS NULL AND details_date >='$currentDate') OR (details_end_date >= '$currentDate') and DATE_FORMAT( `details_date` , '%Y' )='".$row['years']."' and DATE_FORMAT( `details_date` , '%M' )='".$row1['Month']."'"; $Res2=mysql_query($sql2, $connection); while($getRecord=mysql_fetch_assoc($Res2)) { $getRecord['details_date']; $breakDate=explode("-", $getRecord['details_date']); echo ("<br><font size='11'><font color='#F9D9A3'> " . $getRecord['start_date']); if($getRecord['end_date'] > "00") { echo (" - " . $getRecord['end_date']);}; echo (", " . $getRecord['start_year'] . "</font><br>"); echo (" " . $getRecord['details_church']); echo "<br>"; echo (" " . $getRecord['details_city_state']); echo "<br>"; if($getRecord['details_pastor'] > " ") { echo (" " . $getRecord['details_pastor']); echo "<br>";}; if($getRecord['details_phone'] > " ") { echo (" " . $getRecord['details_phone']); echo "<br>";}; if($getRecord['details_link'] > " ") { echo (" <a href='".$getRecord['details_link']."' target='_blank'><u><font color='#378ABC'>" . $getRecord['details_link']); echo "</font></u></a><br>";}; echo ("</font><br>"); } } } include("itn.closedb.php"); ?> Something in there is causing the problem.
  5. That should have worked but for some reason. :-\ It still doesn't work. I'll have to go back and strip down all of the code until I get it working. Thanks a lot though.
  6. WHERE details_end_date > CURDATE() won't work because details_end_date is an optional field that may contain NULL values for some records.
  7. I have a MySQL statement that seems to malfunction. All records contain two date fields: details_date and details_end_date details_end_date can contain NULL values while details_date is a required field My query below only shows records whose detail_date is greater than or equal to currentDate. However, I also need any records whose details_end_date is greater than or equal to currentDate even if its details_date is less than currentDate. Can anyone tell me what's wrong with my query? $sql2="SELECT *, DATE_FORMAT(`details_date`, '%M %d') AS start_date, DATE_FORMAT(`details_end_date`, '%d') AS end_date, DATE_FORMAT(`details_date`, '%Y') AS start_year FROM itn_details WHERE details_date >='$currentDate' OR details_end_date >= '$currentDate' and DATE_FORMAT( `details_date` , '%Y' )='".$row['years']."' and DATE_FORMAT( `details_date` , '%M' )='".$row1['Month']."'"; Thanks!
  8. I just realized that my hosting company will NOT allow a script to write to a file in the public web space because of security reasons. So ... Thanks any way. ks
  9. I'm not sure. I'm a newbie at best. Anyway, I want the code that's echoed below to be written to an xml file named path/mypodcast.xml: <?php //load database source files require("../scripts/webcasts.globals.php"); require("../scripts/webcasts.opendb.php"); // Perform database query $result = mysql_query("SELECT *, date_format(d_Date, '%a. %b %d, %Y') AS date, date_format(d_Date, '%a. ') AS day, date_format(t_Time, '%h:%i') AS time FROM tblWebcasts WHERE i_Id = 1", $connection); if(!$result) { die("Database query failed. Please report this error to web site administrator"); } echo ("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n"); echo ("<rss>\n"); echo (" <channel>\n"); echo (" <title>" . $line['c_Title'] . "</title>\n"); echo (" <description>My description here</description>\n"); echo (" <link>http://www.mydomain.com</link>\n"); echo (" <category domain=\"\">Religion & Spirituality:Christianity</category>\n"); echo (" <copyright>©Copyright name of entity. All Rights Reserved.</copyright>\n"); echo (" <language>en-us</language>\n"); echo (" <lastBuildDate>" . $line['date'] . "</lastBuildDate>\n"); echo (" <managingEditor>[email protected]</managingEditor>\n"); echo (" <pubDate>" . $line['date'] . "</pubDate>\n"); echo (" <generator></generator>\n"); echo (" <item>\n"); echo (" <title>" . $line['c_Title'] . "</title>\n"); echo (" <description>description here</description>\n"); echo (" <link>http://www.mydomain.com/" . $line['c_Filename'] . "</link>\n"); echo (" <category domain=\"\">Religion & Spirituality:Christianity</category>\n"); echo (" <enclosure url=\"http://www.mydomain.com" . $line['c_Filename'] . "\" length=\"19409371\" type=\"audio/mpeg\"/>\n"); echo (" <guid isPermaLink=\"false\">CF1BC542-D123-47B9-8FA8-023A63B719F1</guid>\n"); echo (" <pubDate>" . $line['date'] . "</pubDate>\n"); echo (" </item>\n"); echo (" </channel>\n"); echo ("</rss>\n"); //close database connection require("../scripts/webcasts.closedb.php"); ?>
  10. I can easily write a php script to output XML from my mySQL database. However, podcast aggregators need the file to end with the XML extension. How do I get my php script to write the results to an external file with the XML extension?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.