Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 13th, 2006, 2:15 PM   #1
proudnerd
Newbie
 
Join Date: May 2006
Posts: 21
Rep Power: 0 proudnerd is on a distinguished road
Virtual pet site MySQL question

I have a question about making a virtual pet site (you probably don't need any virtual pet site-making experience to answer it, though). My question is would I make the amount of spending points the user has part of a MySQL database and update it everytime they earn more, buy something, etc. or would I do it a different way? Thank you for taking the time to read my newbish question.
proudnerd is offline   Reply With Quote
Old May 13th, 2006, 2:53 PM   #2
RAzR Creations
Programmer
 
RAzR Creations's Avatar
 
Join Date: Apr 2006
Location: orange park Fl
Posts: 53
Rep Power: 3 RAzR Creations is on a distinguished road
i would actually set up a timer to update every time or just to update everyone every second if thats what you are talking about but i dont clearly understand tottally what you are talking about tho
RAzR Creations is offline   Reply With Quote
Old May 13th, 2006, 3:10 PM   #3
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 708
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Everytime the user log on, record the time into the Mysql DB. Then, everytime the session refreshes, record the time, and compare it to the record you have. Calaculate the difference and assign the correct number of points or money or w/e. That is how it's done most of the time.

@Razr - Good idea, but it won't work with PHP and MySQL. It would only work with application programming
Booooze is offline   Reply With Quote
Old May 13th, 2006, 3:40 PM   #4
proudnerd
Newbie
 
Join Date: May 2006
Posts: 21
Rep Power: 0 proudnerd is on a distinguished road
I never thought of doing that, Booooze. How would I do it, though? I just started programming in PHP yesterday so I have no clue.
proudnerd is offline   Reply With Quote
Old May 13th, 2006, 3:49 PM   #5
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 708
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Quote:
Originally Posted by proudnerd
I never thought of doing that, Booooze. How would I do it, though? I just started programming in PHP yesterday so I have no clue.
That's fine, not to worry. Unfortuantley, I have the code at home, but try and get a start on it for now and I'll be happy to help you out with problems later on tonight (Im at work right now, posting on and off, but dont have php).

For a start, figure out how to display the time in PHP. I'd start by simply writing to a text file. Once you have that, get the ability to read it as well, and display it on the page. At the same time, write the current time. At this point you should have 2 times. Then try and compare the too. Unfortunatley I can't remember how to do it, so simply google it, and see what you can come up with. Onc eyou have taht, look up a cookies and sessions tutorial. Then post back. gtg
Booooze is offline   Reply With Quote
Old May 13th, 2006, 4:12 PM   #6
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 708
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
Good Links:

http://www.highlystructured.com/comp...dates_php.html

http://ca.php.net/date

Bookmark php.net, if you havent already php.net has the whole manual to php if you didn't know that. Have fun
Booooze is offline   Reply With Quote
Old May 13th, 2006, 7:22 PM   #7
proudnerd
Newbie
 
Join Date: May 2006
Posts: 21
Rep Power: 0 proudnerd is on a distinguished road
Thanks for the links Booooze.
proudnerd is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:12 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC