Jump to content

p2492

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

p2492's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay I got it working, thanks for your help guys! I'm slowly learning
  2. Hmm that doesn't seem to be working either, it's still showing the past dates. 'date' is the name of the date field. This is what I have.. $result = mysql_query("select show_id, month, day, year, location, venue, DATE_FORMAT(`date`,'%m.%d.%y') AS date from $database_table WHERE 'date' > CURDATE() ORDER BY date ASC limit 5",$db) or die_now("Could not select shows");
  3. I changed the date to YYYY-MM-DD. How do I go about showing only current and future dates now? Thanks
  4. The script was already set up this way, I am just editing it. I don't know much about PHP and databases if you couldn't tell. That didn't seem to work, it didn't show anything. Thanks for your time!
  5. I am trying to only show the events occurring today and on future dates. The problem is that the day, month, and year in my database are separate and with the code I have now it isn't treating them as one, so the month will show future months, the day will show future days, and the year will show future years. For example, today is 01.17.2011 and the next day (that should be displayed as well) is 02.03.2011, but with the code I have it only shows 01.17.2011 because the day in the other date is less than 17. I hope I am making sense.. any help would be great <?php // connect to the RDBMS $db = mysql_connect("$site","$user","$pass") or die_now("Could not connect to database server. Check passwords and sockets"); // select the database mysql_select_db("$database",$db) or die_now("Could not select database $database. Check database name."); // select all the shows in the database $result = mysql_query("select show_id, month, day, year, location, venue from $database_table where month >= month( now()) and day >= day(now()) and year >= year(now()) order by year, month, day limit 5",$db) or die_now("Could not select shows"); // output the current shows echo("<div class='shows_place'>\n"); while($row = mysql_fetch_array($result)) { $the_id = $row["show_id"]; $the_month = $row["month"]; $the_day = $row["day"]; $the_year = $row["year"]; $the_location = $row["location"]; $the_venue = $row["venue"]; // shows echo("<table><tr><td>" . "$the_month" . "." . "$the_day" . "." . "$the_year" . " - </td>"); echo("<td>" . "$the_venue" . " - </td>"); echo("<td>" . "$the_location" . "</td>"); } echo("</tr></table></div>"); ?>
  6. I am trying to display certain MySQL data based off of what link is clicked. For example.. I want to display all the entries from 2009 when a link for 2009 is clicked; maybe like.. <a href="http://website.com/page?yr=09">2009</a> But I am having trouble doing so.. any help would be great! P.S. The years are in my database with only the last two numbers.. 10, 09, 08, etc. $result = mysql_query("select setlist_id, month, day, year, name, venue, location, label1, set1, set2, set3, encore, notes, photos, recording, poster from $database_table order by setlist_id DESC, year, month, day",$db) or die_now("Could not select setlists"); while($row = mysql_fetch_array($result)) { $the_id = $row["setlist_id"]; $the_month = $row["month"]; $the_day = $row["day"]; $the_year = $row["year"]; $the_name = $row["name"]; $the_venue = $row["venue"]; $the_location = $row["location"]; $the_label1 = $row["label1"]; $the_set1 = $row["set1"]; $the_set2 = $row["set2"]; $the_set3 = $row["set3"]; $the_encore = $row["encore"]; $the_notes = $row["notes"]; $the_photos = $row["photos"]; $the_recording = $row["recording"]; $the_poster = $row["poster"]; echo("<div class='date' id='date' tabindex='0'>" . "$the_month" . "." . "$the_day" . "." . "$the_year" . " - "); echo ($the_name != '') ? "" . "$the_name" . " - " : ''; echo("" . "$the_venue" . " - " . "$the_location" . "</div>"); echo("<div class='set'>" . "$the_label1" . ":<br /></div><div class='list'>" . "$the_set1" . "<br /></div>"); echo ($the_set2 != '') ? "<div class='set'>Set Two:<br /></div><div class='list'>" . "$the_set2" . "<br /></div>" : ''; echo ($the_set3 != '') ? "<div class='set'>Set Three:<br /></div><div class='list'>" . "$the_set3" . "<br /></div>" : ''; echo ($the_encore != '') ? "<div class='set'>Encore:<br /></div><div class='list'>" . "$the_encore" . "<br /></sdiv>" : ''; echo("<div class='line'></div>"); echo nl2br("<div class='notes'>" . "$the_notes" . "</div>"); } When I replace the $result line with... $result = mysql_query("SELECT * FROM `$database_table` WHERE `year` = '09' order by setlist_id DESC, year, month, day",$db) or die_now("Could not select shows"); ... I get all the results from just 2009, which is what I want, but I want the results to depend on what link has been clicked. I hope I am making sense.
×
×
  • 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.