MY Big Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Mastermind
Forum Commoner
Posts: 36
Joined: Thu Mar 10, 2005 2:38 am
Location: CDO,Philippines
Contact:

MY Big Problem

Post by Mastermind »

Dear Friends,

I have a problem today about php there he is create a web site that will allow the user to enter the user to enter jokes.Each joke should have their own unique identifier and every joke entered should have a corresponding date entry in the database as well as the name of fields..
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

and the problem is......?
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

I had a rant about this a while ago.

Here's the problem: you aren't good enough at PHP to attempt this yet.
What you want to do is really simple, so go and pick up a 'beginners PHP' book or look up a PHP tutorial on the net and actually learn the language, rather than just get told the bits of information you need.

Mmm'kay?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Grim... wrote:I had a rant about this a while ago.

Here's the problem: you aren't good enough at PHP to attempt this yet.
What you want to do is really simple, so go and pick up a 'beginners PHP' book or look up a PHP tutorial on the net and actually learn the language, rather than just get told the bits of information you need.

Mmm'kay?
Tone down your arrogance, Grim. How about you help mastermind to find the solution, to coach him - or is that beyond what you think posting on this forum is all about?
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Yes it is - this is the general discussion forum.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

However, in the spirit of good will, he could do worse than starting here:

http://www.tizag.com/phpT/
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Save us your attitude, Grim, and start helping people.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

How is that not helping?

That's a really good beginners tutorial...
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Okay mastermind, here's what I'd do...

First, set up your database so that the 'jokes' table (or whatever) has a auto-incrementing index, called 'ID', a text field called 'Joke' and a long interger field called 'Date'.

Make a HTML form that asks for the joke (with a text area called 'joke'), and have it submit to a page called 'add.php'.

On add.php, you want something along the lines of:

Code: Select all

<?php

//connect to your database here...

addslashes($joke);
$edate = mktime();

mysql_query ("INSERT INTO jokes (Joke, Date) VALUES ('$joke', '$edate')");

?>

Thanks for the joke!
When you want to get the date out again, use

Code: Select all

<?php
date("M-d-Y", $the_number_from_the_database);
The Id of the joke will be automatically inserted by the database.

This is not tested, but looks okay.

Good luck :)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Post by josh »

The OP still hasn't stated his problem. He didn't even ask a question.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Yeah, but I got told off, so I figured it would be easier to take a guess.
Post Reply