grungeandgaze Posted September 29, 2013 Share Posted September 29, 2013 Hi, Last May I created a website that is dedicated to music reviews and news. After a few months, the site was getting big, we had a large database and we were being noticed by many labels, bands and PR companies. In September last year, a student offered to help me with a php design that would make the management of my site easier and automated. He had initially scheduled a deadline for February. However, he doesn't seem in too much of a hurry to get the site up and running, and we've now lost most of our reputation. Last night, after another day where the guy made me believe he had worked hard to change a couple of colours and some format in CSS, but without managing to make the site look any better, I decided to tackle the CSS side of things myself, having built my own site six years ago, I was surprised at how much I still remembered. Anyhow, I'm in no way knowledgeable in php and there are several issues that seem like they would be very easy to solve if I knew how. I would wait for the guy to do it, but he's never in a hurry and we need the site up and running again. My first question would be the following. On the album review page (http://therealmusic.net/reviews/Jackleg-Devotional-to-the-Heart-2013) the release date should only show the month and the year, not the day. I've been asking the guy to sort this out for months now, but he always make it out to be a big deal. Here's the code I have, what do I need to add so it only extracts the month and year? <?php echo "<b>Released:</b> " . $albumreleasedate . "</br>". "<b>Genre:</b> " . $genrename . "</br>". "<b>Label:</b> " . $labelname; ?> Many thanks Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 29, 2013 Share Posted September 29, 2013 (edited) Where is the variable $albumreleasedate defined and how is the date formatted in the database? A quick and easy fix (hack) would be to do list($dayth, $month, $year) = explode(' ', $albumreleasedate); $albumreleasedate = $month . ' ' . $year; before the echo line. Edited September 29, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
Barand Posted September 29, 2013 Share Posted September 29, 2013 $albumdate = '2012-01-31'; $albummonth = date('F Y', strtotime($albumdate)); //--> January 2012 Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 In the database the date appears under a column titled DateOfRelease UNIX_TIME 1:1:1 1/1/YYYY (s:m:h dd/mm/yyyy) With entries along the following line: 1262329261 Don't where to find how the variable is defined. When I enter the info to the database, the form allows me to select month and year, no day. Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 Great, this worked list($dayth, $month, $year) = explode(' ', $albumreleasedate);$albumreleasedate = $month . ' ' . $year; Thanks Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 29, 2013 Share Posted September 29, 2013 Its will be much bettee if you changed the date format where $albumreleasedate is defined. If your want to change the format of the date latter on this solution may not work. Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 (edited) Is this where it is defined? <?php require_once(LIBRARY_PATH . "/session.php"); //get review data from database $sql = "SELECT A.AlbumNr AS AlbumNr, A.Name AS AlbumName, A.DateOfRelease AS AlbumReleaseDate, I.src AS AlbumCover, A.Type AS AlbumType, B.BandNr AS BandNr, B.FirstName AS bandFirstName, B.SecondName AS bandSecondName, R.DatePublished AS DatePublished, R.Rating AS Rating, R.Type AS Type, RC.Content AS Content, P.ProfileNr AS writerProfileNr, P.Name AS writerFName, P.MiddleName AS writerMName, P.SirName AS writerSName FROM (((((Reviews R INNER JOIN Reviews_Content RC ON RC.ReviewNr=R.ReviewNr) INNER JOIN Profile P ON P.ProfileNr=R.EmployeeNr) INNER JOIN Albums A ON A.AlbumNr=R.AlbumNr) INNER JOIN BandsAlbums BA ON BA.AlbumNr=A.AlbumNr) INNER JOIN Bands B ON BA.BandNr=B.BandNr) INNER JOIN Images I ON I.ImageNr=A.Cover WHERE R.ReviewNr=" . $reviewnr . ";"; $database->query($sql); $review = $database->loadObjectList(); header('Content-Type: application/xml; charset=UTF-8'); require_once(LIBRARY_PATH . "/xml.php"); $xml = new XMLWriter(); $xml->openURI("php://output"); $xml->startDocument('1.0', 'UTF-8'); $xml->setIndent(true); //start root element band $xml->startElement('review'); $xml->startElement('band'); $xml->writeAttribute('id', $review['BandNr']); $xml->startElement('name'); $xml->writeElement('firstname', utf8_encode(escape_xml($review['bandFirstName']))); $xml->writeElement('secondname', utf8_encode(escape_xml($review['bandSecondName']))); //end name element $xml->endElement(); //end band element $xml->endElement(); $xml->startElement('album'); $xml->writeAttribute('id', $review['AlbumNr']); $xml->writeElement('name', utf8_encode(escape_xml($review['AlbumName']))); $xml->writeElement('dateOfRelease', utf8_encode(escape_xml($review['AlbumReleaseDate']))); $xml->writeElement('cover', utf8_encode(escape_xml($review['AlbumCover']))); $xml->writeElement('type', utf8_encode(escape_xml($review['AlbumType']))); //end album element $xml->endElement(); $xml->writeElement('datePublished', utf8_encode(escape_xml($review['DatePublished']))); $xml->writeElement('rating', utf8_encode(escape_xml($review['Rating']))); $xml->writeElement('type', utf8_encode(escape_xml($review['Type']))); $xml->startElement('content'); $xml->writeCdata(utf8_encode(nl2br($review['Content']))); //end content element $xml->endElement(); $xml->startElement('writer'); $xml->writeAttribute('id', $review['writerProfileNr']); $xml->startElement('name'); $xml->writeElement('firstname', utf8_encode(escape_xml($review['writerFName']))); $xml->writeElement('middlenames', utf8_encode(escape_xml($review['writerMName']))); $xml->writeElement('secondname', utf8_encode(escape_xml($review['writerSName']))); //end name element $xml->endElement(); //end writer element $xml->endElement(); //end root element review $xml->endElement(); ?> Edited September 29, 2013 by grungeandgaze Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 29, 2013 Share Posted September 29, 2013 (edited) no, that is where it is getting the raw data from the database (the 1262329261 value) and is storing the data in xml format. Somewhere else is another php file which processes this xml data. The line of code you're looking for is in this format $albumreleasedate = ... something here...; it may look: $albumreleasedate = date('jS F Y', ...somthing here with AlbumReleaseDate in it...); Edited September 29, 2013 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted September 29, 2013 Share Posted September 29, 2013 You should really being storing dates in the database as DATETIME. Which would look like '2013-09-29 15:04:00', which is human readable and also easier to work with as you can manipulate the value in the query quite easily, and also manipulate it in PHP just as easily too. Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 Still can't find that code and the dude is being evasive once more, so I can't get any info on the file whereabouts. Will post it up asap. Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 This is the only thing I've found that mentions the date. It's also the only thing I've found with definitions. //Calculate unix time from date $unixTime = mktime(1, 1, 1, 1, $_POST['month'], $_POST['year']); if(isset($_POST['compilation'])){ $type = "3"; }else{ $type = $_POST['type']; } Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 29, 2013 Share Posted September 29, 2013 No That is what makes the unix timestamp for the date you enter in the form by looks of things. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 29, 2013 Share Posted September 29, 2013 $unixTime = mktime(1, 1, 1, 1, $_POST['month'], $_POST['year']); The order of the parameters is wrong in that statement. The final 3 should be month, day, year Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 Just found this too, still not sure $xml->startElement('dateOfRelease'); $day = gmdate("d", $ep['date']); $month = gmdate("m", $ep['date']); $year = gmdate("Y", $ep['date']); $xml->writeElement('day', utf8_encode(escape_xml($day))); $xml->writeElement('month', utf8_encode(escape_xml($month))); $xml->writeElement('year', utf8_encode(escape_xml($year))); //end dateOfRelease element $xml->endElement(); Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 $unixTime = mktime(1, 1, 1, 1, $_POST['month'], $_POST['year']); The order of the parameters is wrong in that statement. The final 3 should be month, day, year Changed it to this: $unixTime = mktime(1, 1, 1, 1, $_POST['month'], $_POST['day'], $_POST['year']); Quote Link to comment Share on other sites More sharing options...
Barand Posted September 29, 2013 Share Posted September 29, 2013 Too many 1's (hr, min, sec, month, day, year) Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted September 29, 2013 Share Posted September 29, 2013 Is there a reason why the data is being extracted from the DB and put into XML? From a business POV, please tell me you fired the student. Delays are common in this field (although, a quality developer can ballpark how long a project will take and add in a buffer for unforeseen consequences), but a 7-8 month delay? Inexcusable. Especially with modern tools and frameworks. Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 29, 2013 Author Share Posted September 29, 2013 (edited) Is there a reason why the data is being extracted from the DB and put into XML? From a business POV, please tell me you fired the student. Delays are common in this field (although, a quality developer can ballpark how long a project will take and add in a buffer for unforeseen consequences), but a 7-8 month delay? Inexcusable. Especially with modern tools and frameworks. I'm not paying him, he offered to do it for the experience. We're just screwed now because I have a half finished code he's done, but I don't have the financial means to hire someone to finish. Kind of stuck in a hole. I managed to do some CSS and cleaned the look up, it looked terrible yesterday. And I'm going through php tutorials to see if I can advance anything. Edited September 29, 2013 by grungeandgaze Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 29, 2013 Share Posted September 29, 2013 and the answer to Kevin's question? - Is there a reason why the data is being extracted from the DB and put into XML? the code you have posted so far, implies the data is being processed three times. if you had a database driven site that worked and looked the way you wanted it and the recent coding was just to support entering the data on the back end, that's the only thing that should have been affected. Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted September 30, 2013 Share Posted September 30, 2013 I'm not paying him, he offered to do it for the experience. We're just screwed now because I have a half finished code he's done, but I don't have the financial means to hire someone to finish. Kind of stuck in a hole. I managed to do some CSS and cleaned the look up, it looked terrible yesterday. And I'm going through php tutorials to see if I can advance anything. I understand that kind of situation all too well. In fact, my career to date has largely revolved around fixing the messes poorly skilled and/or unmotivated developers, interns, and students have made. It's kept me pretty busy. Unfortunately, you're discovering that even though you didn't pay the student any money, you're still paying with wasted time and a damaged brand. That said, I hope the experience doesn't make you gun shy about hiring students in the future. There are many out there who would love to have a real project they could add to their portfolio. The key in finding them is to do your due dilligence. Ask for references. Ask to see examples of what they can do (completed homework assignments are great if this is what they're studying). Just because you're not paying cash doesn't mean it's not a business arrangement. Maybe you did do all those things and you got a dud. It happens. But in my experience, it's usually a case of a lack of communication and no clear cut boundaries or responsibilities that lead to these kinds of problems. I'm not trying to chastise or kick you while you're down. Just trying to share my experience so you don't get screwed over again. I tell my clients much the same so when I move on from them they can make good technical business decisions without me. Quote Link to comment Share on other sites More sharing options...
grungeandgaze Posted September 30, 2013 Author Share Posted September 30, 2013 and the answer to Kevin's question? - the code you have posted so far, implies the data is being processed three times. if you had a database driven site that worked and looked the way you wanted it and the recent coding was just to support entering the data on the back end, that's the only thing that should have been affected. I don't know how the data is processed, I don't really understand that side of things. Our previous site format was more of a blog type thing. I'd have to make a new page for every new review or anything I wanted to post, without a template. I would then have to manage all the menu pages and home page to keep it up to date, deleting older stuff so the newer was placed top...the host was very limited. All I know about the designers code is that he has made it to be secure, he is extremely paranoid about hackers for some reason. We wil be having a user interface further down the line, and think this was his issue. @Kevin: Yeah, I'll definitely use students again, think it's good for them to get the required experience to find work after Uni. The main reason I decided to go along with the current guy is because he seemed very enthusiastic about it and I really needed an improved site. But like you said, there's the loss of business, even if it wasn't financial, but more based on reputation, which has been severely hindered. I just know that once the site is back up, I'll have to start all the work I put in building relationships from scratch. Least I know for next time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.