New to php coding,

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
Homeboy
Forum Newbie
Posts: 6
Joined: Fri Aug 05, 2005 12:23 pm

New to php coding,

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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 :(
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

ha heck you confused me
Homeboy
Forum Newbie
Posts: 6
Joined: Fri Aug 05, 2005 12:23 pm

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Homeboy
Forum Newbie
Posts: 6
Joined: Fri Aug 05, 2005 12:23 pm

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Last edited by s.dot on Fri Aug 05, 2005 1:28 pm, edited 1 time in total.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Homeboy
Forum Newbie
Posts: 6
Joined: Fri Aug 05, 2005 12:23 pm

Post by Homeboy »

I am talking about what do I do in the phpAdmin like how do I do the stuff?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply