Jump to content

roytheboy

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

roytheboy's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks Muddy_Funster, did as instructed and now works! RTB.
  2. I guess as I am typing in the dates pertaining to the event instead of them being automatically generated I assumed this might be stored as text (Varchar)? Thanks for pointing this out! Would I have to input this in a particular format? I have been using eg. 12-November-2012 Please excuse the novice in me. RTB
  3. Hi there, being a novice I am having problems showing files on my webpage in proper date order. They are stored in a mysql database. I have stored the files in a table called filestore which has 5 columns: ID = int column StoryDate = Varchar column fileName = Varchar column mimetype = Varchar column description = Varchar column filedata = mediumblob column The dates look like this: 8-November-2011, 21-March-2012 etc. and when drawn from the database they are formatted by an external file 'date.php' to look like this: 08-11-2011, 21-03-2012 etc. I tried to order by date DESC. Below is a snippet of the code: // Default page view: lists stored files $sql = 'SELECT id, filename, mimetype, storydate FROM filestore ORDER BY filestore.storyDate DESC, filestore.ID LIMIT 60'; $filelist = @mysql_query($sql); if (!$filelist) { exit('Database error: ' . mysql_error()); } ?> I wonder could the problem be that 'StoryDate' Varchar column is the wrong type? should it be Date or something else? The webpage in question is here: http://www.sercweb.com Any help greatly appreciated! Roytheboy.
  4. Thanks a lot litebearer I will try that.... does that mean I would [b]not[/b] have to also alter the SQL SELECT query in the dbobj.php file I mentioned previously? function getCaseStudies() { $this->query = "SELECT * FROM document WHERE type_id='case' ORDER BY date_created DESC;"; $rs = mysql_query($this->query); return ($rs); } regards, roytheboy
  5. Hello gang, I am quite new to php & MySQL and have been given the task of amending a website which has a database that is scripted to show the latest 20 entries on a web page for the case studies section. This needs to be changed to show latest entries for the last 3 months instead without deleting anything from the database. Here is the script as it stands: while ($release = mysql_fetch_array($case)) { if ($count > 20) break; //don't show more than 20 docs $logo = "./assets/pics/agents/".$release['agent_id'].".jpg"; $agent = $db->getAgent($release['agent_id']); $res = $db->getImagesByDocument($release['id']); $has_images = false; while ($a = mysql_fetch_assoc($res)) $has_images = true; $aFeatures = array(); $doctype = substr($release['filename'],-3,3); for ($i=0;$i<=20;$i++) { Also, a function seems to have been used and required once from a file dbobj.php to call up from the database: function getCaseStudies() { $this->query = "SELECT * FROM document WHERE type_id='case' ORDER BY date_created DESC;"; $rs = mysql_query($this->query); return ($rs); } I have tried using the time stamp function but I couldn't figure out how [b]not[/b] to pinpoint specific months instead of just the 3 month period. Here is the URL: [a href=\"http://affordablehomeowndership.myzen.co.uk/v1.8/\" target=\"_blank\"]http://affordablehomeowndership.myzen.co.uk/v1.8/[/a] Any help will be greatly appreciated. Kind regards, RTB.
×
×
  • 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.