Any help with my own 'joke of the day'?<

windows

Guest
Let me start by telling you that I am a real newby on PHP. I've done a lot of HTML and then forgot to update my skills for a couple of years (OH stupid me...)

If someone could write a small tutorial for me or could point me to a good tutorial, it would be much appreciated!

So what do I want to do?

I want to have my own "joke of the day" on my site.... (just text)

I know there are a lot of sites around that offer this but I never like their jokes.... So thats why I wanted to don it myself...

I allready selected a whole bunch of jokes... (360!)

I like it to update every 24 hours, and then automaticly pick the next joke from all I have.. And then impliment it into a table I have on my site.. Now I have to copy and paste every day, not really a good solution...

Something tells me I can do that with PHP and iframes. BUT I'm only experienced with straight html...

Could someone help me?personally I would put all teh jokes in a database an dgo from there. yes you would need php but it will be alot easier to manager if it was in a db.Yes that is what I was thinking... But how would I go about with the automatic updates after 24 hours? Can someone help me with that.. I'm really eager to read some good tutorials on this topic.. But, I really cant find one....well, you need to look into date() (<!-- m --><a class="postlink" href="http://us4.php.net/manual/en/function.date.php">http://us4.php.net/manual/en/function.date.php</a><!-- m -->) and then you have to query the database. best bet is to keep the date in the db of the joke used so it doesn't get used fo rthat day. personally I would do it random.Thanks.

Do you know any tutorial that covers these topics? (eg. Having php query a database with dates and jokes? Thanx...)agent helped me with a simmilar thing in this thread (<!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?s=&threadid=35747">http://www.htmlforums.com/showthread.ph ... adid=35747</a><!-- m -->)..

it will take some editing for sure, since of 365 days, but it's a nice script :)Actually the script he posted before he made that one for you is better suited for me I think...

I only have a problem with creating the data bases now....

(This is what the readme tells me...)

// -------------------- Installation --------------
// 1. Upload the quote.php to your web server.
// 2. Change the following variables $DB_SERVER,$DB_USER, $DB_PASS,$DB_NAME
// (see below)
// 3. Create the needed tables in your database with the quotes.sql file.
// You can do it from the prompt (mysql -u[username] [-p] [database] < quotes.sql)
// or you can use the wonderful phpMyAdmin at <!-- m --><a class="postlink" href="http://www.phpwizard.net/projects/phpMyAdmin/">http://www.phpwizard.net/projects/phpMyAdmin/</a><!-- m -->
// 4. Point your browser to <!-- m --><a class="postlink" href="http://yourdomain/quotes.php">http://yourdomain/quotes.php</a><!-- m -->
// 5. Add your own quotes to the database and custumize the script as you see fit.


====================================



In the zipfile there is a quotes.sql file... What should I do with that file? Can I run it or something? It looks like this...




CREATE TABLE quotes (
id int(9) unsigned NOT NULL auto_increment,
quote text NOT NULL,
author varchar(150) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY id (id)
) TYPE=MyISAM;

#
# Test Data for `quotes`
#

INSERT INTO quotes VALUES (1,'This is the quote number 1 ','Author name here...');
INSERT INTO quotes VALUES (2,'This is the quote number 2 ','Author name here...');
INSERT INTO quotes VALUES (3,'This is the quote number 3 ','Author name here...');
INSERT INTO quotes VALUES (4,'This is the quote number 4 ','Author name here...');
INSERT INTO quotes VALUES (5,'This is the quote number 5 ','Author name here...');


CREATE TABLE quotes_meta (
id int(11) NOT NULL default '0',
number_reached mediumint(9) NOT NULL default '0',
date_modified mediumint(9) NOT NULL default '0',
PRIMARY KEY (id),
KEY id (id)
) TYPE=MyISAM;

#
# The real Data for `quotes_meta`
#

INSERT INTO quotes_meta VALUES (1,1,1);

-----------------------------------------

I know how to make a table myself in PHPMyAdmin but I dont understand what this file is meant to be. Also I don't know how to implement the values for these tables (you can see above) by myself....

Can someone help me? I almost feel ashamed asking this...
:(that file will make the tables and insert some data to use. all you have to do is do a "insert" in phpmyadmin and run it. phpmyadmin will do all the work for you.I've got it to work!!! So much thanks eveyone!!!!!!!
 
Back
Top