ok, it works now, butfor year its just putting the letter two in the database it suppost to be 02, and it prints 02 on the preview page
@months = qw(January Febuary March April May June July August Septemb
+er October November December);
@hours = qw(1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12);
$time = ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = local
+time(time);
$year += 1900;
$year = sprintf("%02d", $year % 100);
$new = $lastnumber + 1;
if($hour > 12) { $AP = "PM"; }
else { $AP = "AM"; }
print "<p>Your news has been added</p><u><b>Preview</b></u><br>
<p>$months[$mon] $mday $year <b>at</b> @hours[$hour]:$min $AP
+<b>($user)</b></p><p><b>",param("title"),"</b><br>",param("des"),"</p
+>";
$sth = $dbh->prepare("INSERT INTO news(username, month, day, hour, mi
+n, AP, title, description, year) VALUES ('$user', '$months[$mon]', '$
+mday', '$hours[$hour]', '$min', '$AP', ?, ?, '$year')");
$sth->execute(param("title"), param("des")) or die $dbh->errstr;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.