Jump to content

oregoncurtis

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

oregoncurtis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well does anyone have any good links to tutorials?
  2. Hey all, I'm building my own blog from scratch and i want to add comments, but i'm not exactly sure how to go about this. Should i create a new table in mySQL that's separate from my blog table? What rows/ columns will i need? Here's the site: http://junkdrawer.web44.net Please let me know if this is in the wrong section. ( i know this falls into mySQL and php) Thanks! -Curtis
  3. Actually i guess i haven't solved it. I can get it to display the correct seconds, but i don't know the code to display current hour and minute i tried H and m, but those don't work. Anyone know? Edit i got the minutes right, but when i try H for hours i get 22, but it's 19 where i'm at. When i try h i get 10, but it's 7 here. How can i change it to my time? I know it must be on the servers time (which must be in the east coast).
  4. Thanks, but i think i might have just solved it so that the mySQL stores the time stamp in Y-m-d H:m:s format.
  5. strtotime( . ” ” . 06 04 2008 . ” ” . . ” ” . ) So the string to time isn't working?
  6. Well i want a timestamp so that i can post multiple blog entries in a day and it will order them correctly i guess. I have 4 rows in my mySQL table that are from top to bottom id, timestamp, title, entry. The timestamp field is formatted as datetime in mySQL. When i post an entry all the fields but timestamp work. The time stamp for each entry is all zeros. So for some reason the time and date aren't posting to mySQL. Why? Curtis
  7. Heres the code for the form submission page. Obviously something has got to be wrong. Ideally i don't want to be able to change the date and time so i want to get rid of those areas and just have input for title and content. That's a seperate issue i can solve on my own. Can anyone tell me what's wrong with the timestamp function? Thanks <?php if (isset($_POST['submit'])) { $month = htmlspecialchars(strip_tags($_POST['month'])); $date = date("m d Y"); $year = htmlspecialchars(strip_tags($_POST['year'])); $time = htmlspecialchars(strip_tags($_POST['time'])); $title = htmlspecialchars(strip_tags($_POST['title'])); $entry = $_POST['entry']; $timestamp = "strtotime($month . ” ” . $date . ” ” . $year . ” ” . $time)"; $entry = nl2br($entry); if (!get_magic_quotes_gpc()) { $title = addslashes($title); $entry = addslashes($entry); } mysql_connect (DELETED FOR PRIVACY) ; mysql_select_db (DELETED FOR PRIVACY); $sql = "INSERT INTO php_blog (timestamp,title,entry) VALUES ('$timestamp','$title','$entry')"; $result = mysql_query($sql) or print("Can’t insert into table php_blog.<br />" . $sql . "<br />" . mysql_error()); if ($result != false) { print "Your entry has successfully been entered into the database."; } mysql_close(); } ?> <?php $current_month = date("F"); $current_date = date("d"); $current_year = date("Y"); $current_time = date("H:i"); ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p><strong><label for="month">Date (month, day, year):</label></strong> <select name="month" id="month"> <option value="<?php echo $current_month; ?>"><?php echo $current_month; ?></option> </select> <input type="text" name="date" id="date" size="2" value="<?php echo $current_date; ?>" /> <select name="year" id="year"> <option value="<?php echo $current_year; ?>"><?php echo $current_year; ?></option> </select> <strong><label for="time">Time:</label></strong> <input type="text" name="time" id="time" size="5" value="<?php echo $current_time; ?>" /></p> <p><strong><label for="title">Title:</label></strong> <input type="text" name="title" name="title" size="40" /></p> <p><textarea cols="80" rows="20" name="entry" id="entry"></textarea></p> <p><input type="submit" name="submit" id="submit" value="Submit"></p> </form>
  8. Ok i'm not sure what part of th script i need to change. So could someone point me to any tutorials on building a blog with php and mySQL? Thanks, Curtis Sorry for newb post.
  9. I apologize for posting in the wrong section. Mod's please move for me. Thanks!
  10. ok i'm trying to create my own blog using php and mysql. I've been able to post and display my post, but the post do not have the correct time stamp. they all say dec. 31 1969. What have i done wrong? Let me know what part of the code you need to see or let me know what info you need. Thanks! Here's the form to submit: http://www.junkdrawer.web44.net/formsubmit.html and the resulting blog post: http://www.junkdrawer.web44.net/
×
×
  • 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.