Jump to content

bradkenyon

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Everything posted by bradkenyon

  1. the expiredate is formatted as: for example: 2008-09-11 12:30:00 so i don't know if CURDATE will do the trick.
  2. i want to only display today's events, based on m/d/y using the date function $today = date("m/d/y"); $query = "SELECT * FROM calendar_items WHERE date('m/d/y',strtotime(expiredate)) = $today"; expiredate is the column in the table which it holds the date it is held on, and i want to only display the events for that day to display. so it automatically displays the days events according to today's date. i bet i am going entirely in the wrong direction, but any help is appreciated.
  3. I have an update function w/ a query of this: $queryupd = "select * from calendar_items where id = $id"; I list the data into the update form, from the table calendar_items. I want to restrict it, so only the person who created the calendar item (event), will be able to update it. I have an author column w/i the calendar_items table. I was thinking something along the lines of: $queryupd = "select * from calendar_items where id = $id AND author = $HTTP_SESSION_VARS['valid_username']"; I wanted it to be almost an if statement, "if you're not the author of this event, then print out msg saying: You do not have the right to edit this event."
  4. i rotate a set of photos, 11 to be exact. below is the code i use to make it work, besides the js file that makes the files rotate, but the code below displays 11 lines, photo1.jpg, photo2.jpg, ... photo11.jpg the problem i have is, i want to make the photos to be in random order, so i was thinking i could use the rand() function to list all 11 photos, but in a different order each time, what do you think is the best way to do it? <ul id="crossfadehomepage"> <? $i=1; while($i <= 11) { print '<li><img src="/crossfade/header/photo'.$i.'.jpg" /></li>'; $i++; } ?> </ul>
  5. another question in reference to this. say i have the story marked as a feature. i dont want it to be up there as the featured story until a new one comes out, so i'd like to make an expiration, say it will expire 2 days after it was posted. i did something like this, but i am not sure if this will do the trick. <? include('db.php'); $query = "SELECT * FROM news WHERE featureditem = 'Y' ORDER BY tstamp DESC LIMIT 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { if($row['tstamp'] + 2 > date("Y-m-d H:i:s",time())) { ?> <div class="alertitem"> <h3>News Flash!</h3> <? print '<div class="content">'.$row['subj'].'</div>'; ?> </div> <? } else { print 'expired'; } } ?>
  6. oops. also, i need to fix the query to only look for the very first one, based on tstamp, and stop after it found it.
  7. i have a news system, where you enter a news item into the form, you can check whether or not you want the news item to be a featured item, so if you check the box, it will store a 'Y' in the featureditem column of the table holding the news. i want to do display the most recent item that has the Y within the featureditem column. this is what i have so far, but the subject doesn't display ($row['subj']) when viewing the page. <? include('db.php'); $query = "SELECT * FROM news WHERE featureditem = 'Y' ORDER BY tstamp DESC"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { ?> <div class="alertitem"> <h3>News Flash!</h3> <? $row['subj']; ?> </div> <? } ?> what do you think i am doing wrong? any help is appreciated. thank you.
  8. i am using http://keithdevens.com/software/php_calendar to display the calendar. now i want to take the events within a db table i have w/ events, marked by a timestamp, example timestamp would be 2008-05-07. I want to through the table and grab all the events from may, and link the dates correctly on the calendar, linking the days on the calendar as an id or by the timestamp, whichever you feel is better. here is sample code to get it working hard coded. <? $days = array ( 14=>array('/weblog/archive/2004/Jan/02','linked-day'), 3=>array('/weblog/archive/2004/Jan/03','linked-day'), 8=>array('/weblog/archive/2004/Jan/08','linked-day'), 22=>array('/weblog/archive/2004/Jan/22','linked-day') ); //echo generate_calendar(2004, 11, $days, 3, '/weblog/archive/2004/Jan'); echo generate_calendar(date("Y"), date("m"), $days, 3, '/events/?id='.$row['tstamp'].''); ?> [attachment deleted by admin]
  9. I have a text area, i want to be able to enter text into a db, and when it is displayed on a website, where the person hits return/enter on the keyboard in the textarea cms, it will display as a line break between different paragraphs of text. so the person enters the news item into the cms textarea box, but right now it spits the out the words on the site w/o the line breaks where the person who put it in the cms textarea box w/ a return/enter line break between paragraphs. hope this makes some sort of sense. i have attached a photo to help. thanks in advance. [attachment deleted by admin]
  10. thanks, i always wondered where that button was. duh.
  11. i am trying to upload a file to a directory on my server, then post the filename into the database for future reference. for some reason the file won't upload, nor will it post the filename into the db. i've done this before, but it was done before by having the action="" within the form tag pointing to another page w/ the appropriate code for getting the form results, but i want it to do a php self post, but that is the problem i'm running into w/ getting that file to upload. here is the code. any help is appreciated, thanks! if(!$_POST) { ?> <div class="details"> <form enctype="multipart/form-data" method="post" action="?mode=add"> <? print '<h3>Headline/Subject</h3>'; print '<input type="text" name="subj" size="60">'; print '<h3>Body</h3>'; print '<textarea name="body" cols="70" rows="14"></textarea>'; /* print '<h3>Image URL</h3>'; print '<input type="text" name="imgurl" size="80">'; */ print '<h3>More Info URL</h3>'; print '<input type="text" name="moreurl" size="80">'; print '<h3>Date</h3>'; print '<input type="text" name="tstamp" value="'.date("Y-m-d H:i:s",time()).'" size="20">'; print '<h3>Image Upload</h3> <input type="file" name="uploaded"> <small>(optional)</small><p>'; print '<input type="Submit" value="Submit" name="Submit"> <a href="/cms/">Cancel</a> </form>'; } else { //$id=$HTTP_POST_VARS['id']; $subj=addslashes($HTTP_POST_VARS['subj']); $body=addslashes(htmlspecialchars($HTTP_POST_VARS['body'])); //$imgurl=$HTTP_POST_VARS['uploaded']; $moreurl=$HTTP_POST_VARS['moreurl']; $tstamp=$HTTP_POST_VARS['tstamp']; $filename=$_FILES['uploaded']['name']; if(!$filename == '') { $target = "/web/images/news/"; $target = $target . basename( $_FILES['uploaded']['name']); $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { //echo "The file ".basename( $_FILES['uploaded']['name'])." has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } } mysql_query("INSERT INTO news (subj, body, imgurl, moreurl, tstamp) VALUES('$subj', '$body', '$filename', '$moreurl', '$tstamp')") or die(mysql_error()); include('newslist.php'); } ?>
  12. all i want to do is be able to type in html code as well as plain text and for the html code to display as it should. so for an image, i want <img src="/images/image.jpg"> to display the image in the news item, and when i go to edit that news item, it shows the html code. that is all.
  13. I'll type in the a href = into the textarea as well, so I want it to display <a href="http://www.yahoo.com">yahoo.com</a> in the update text area form, and a linked yahoo.com within the site side of the news item. so when the user views it on the website, they will see yahoo.com as a linked item they can click to go to yahoo.com, and when you go to the backend to update the news item, it will display as <a href="http://www.yahoo.com">yahoo.com</a>, so i want the site side code to translate the <a href=""> and </a> to a link.
  14. I ran into this problem before, but I think its a little harrier this time. An example would be putting this into a textarea field: <a href="http://www.yahoo.com">yahoo.com</a> Then when I display it to update it, it displays as: yahoo.com</a>"><a href="http://www.yahoo.com">yahoo.com</a> I want it to display as what I typed it in, then when it displays in the news page, to display as yahoo.com, as a link. Any help would be appreciated, as I have looked into htmlentities, htmlspecialchars_decode, and htmlspecialchars.
  15. looks just like html mime mail, is there a difference between this and htmlmimemail?
  16. I have used htmlmimemail in the past, but the server i am using it on isn't so nice, so back to the mail() function. is there a way i can attach a file to be included with the email? thanks in advance.
  17. As you mentioned before, w/ the query SELECT * FROM events WHERE expiredate > NOW() is there anyway you can modify the query so it displays the event that has the same date, for example.... Red Cross Blood Drive 4/10/2008 Today's date is 4/10/2008. I want to display that event until the day is over, I was thinking you could modify the query like this... SELECT * FROM events WHERE expiredate > NOW() + 1 or SELECT * FROM events WHERE expiredate >= NOW()
  18. anyway i can modify NOW() to add a day to NOW() so it will include a 4/10 on the day it is 4/10?
  19. I'm looking for the event to stay until 11:59pm of that date, so people can see what happened that day, even if the event was over for a couple hours.
  20. i am trying to only display the events that are not expired. i was thinking that i could do an if statement within the loop, testing if the date is less than the current date, then do not display. any help would be appreciated. while($row = mysql_fetch_array($result)) { $i = 0; $t = 1; while($i <=0) { if($row['expiredate'] > date("Y-m-d",time())) { print '<li><strong>'.date("m/d/y",strtotime($row['expiredate'])).'</strong> - '; if($row['moreurl'] != '') { print '<a href="'.$row['moreurl'].'" target="blank">'.$row['subj'].'</a> - '.$row['location'].''; } else { print $row['subj'].' - '.$row['location']; } print '</li>'; $i++; $t++; } } }
×
×
  • 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.