Page 1 of 1

New to php coding,

Posted: Fri Aug 05, 2005 12:28 pm
by Homeboy
hello,

I am new to php coding. Can i put a php coding in a html file?

Becaue i want to get a code that give you the amount of times the page has been accessed also download. How can i find that and do it on my files?

Thanks

Posted: Fri Aug 05, 2005 12:30 pm
by s.dot
You can put PHP inside of an HTML file, but in order to be executed the file extention would have to be changed from .HTML to .PHP, and then ran on a php enabled webserver.

Tracking visits and downloads can be done by cookies or database. Database would be the most reliable as cookies can easily be deleted or not enabled.

Posted: Fri Aug 05, 2005 12:32 pm
by shiznatix
cookies? how the heck can you have a hit counter with cookies?

the most easy way to do those things is with a flat txt file but the best way it with a database

Posted: Fri Aug 05, 2005 12:34 pm
by s.dot
shiznatix wrote:cookies? how the heck can you have a hit counter with cookies?

the most easy way to do those things is with a flat txt file but the best way it with a database
I was not thinking along the lines of a hit counter, but rather showing how many times a single user has accessed the page.

such as a 'You have visited this page 7 times.' type of deal.

I probably should've specified that, I most likely confused him :(

Posted: Fri Aug 05, 2005 12:38 pm
by shiznatix
ha heck you confused me

Posted: Fri Aug 05, 2005 12:55 pm
by Homeboy
I got the part for when you put php script on to your web page it needs to change to .php instead of .html.

Okay so if i am doing it with a database how do i do it? So I can do it.

My Host does go on php.

Thanks

P.S. Explain is simpliest form. I am very new to it.

Posted: Fri Aug 05, 2005 12:58 pm
by s.dot
First you need to set up a database.
PHPMyAdmin is a wonderful tool for creating databases using a web interface.
-- Your web host most likely has this installed already. Go to your control panel > databases > PHPMyAdmin

Then you need to learn how to perform queries to add to, update, and delete from your database.

http://www.mysql.com is a great resource for one of the most common types of databases -- MySQL.

I couldn't just give you an example of code (probably what you're looking for) because the question is so generic.

Posted: Fri Aug 05, 2005 1:06 pm
by Homeboy
I went to my control panel and do have phpadmin install. But boy is it confusing.

Can at least guide me to where to go?

Thanks

Posted: Fri Aug 05, 2005 1:26 pm
by s.dot
http://www.php.net
http://www.mysql.com
http://www.phpmyadmin.net
http://www.google.com

are your friends. =)

also you should google for a simple database tutorial, read it, reread it, then practice it.

it will teach you tons

Posted: Fri Aug 05, 2005 1:28 pm
by Homeboy
I am talking about what do I do in the phpAdmin like how do I do the stuff?

Posted: Fri Aug 05, 2005 1:47 pm
by feyd