[SOLVED] passing variables to mysql

This is a discussion on "[SOLVED] passing variables to mysql" within the PHP Forum section. This forum, and the thread "[SOLVED] passing variables to mysql are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 15th, 2007, 07:37
Up'n'Coming Member
Join Date: Oct 2007
Location: london
Age: 25
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] passing variables to mysql

Ok so, here is my new problem.

My script works out a variable (the users ip) and then needs to pass it to a mysql table.
Quite simple.

But the trciky bit is that I need my php to run this style of script before it posts the data to the sql.

Does the table for this hour exist? y/n (there will only ever be one hour table which needs to be overwritten each hour)
Does the table for this day exist? y/n (there will be a new table for each day)
Does the table for this week exist? y/n (there will be a new table for each week)
Does the table for this month exist? y/n (there will be a new table for each month)

Create the corresponding table if neccesarry.
Post the data to the all the corresponding tables according to the time and date.

By doing this I am keeping all the tables amended and can pull them back into another php file which will read the data and post it accordingly.

Ok cool. I hope someone has done this before, as im quite unsure how to do this.
Reply With Quote

  #2 (permalink)  
Old Nov 15th, 2007, 19:59
alexgeek's Avatar
Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,771
Blog Entries: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to alexgeek
Re: passing variables to mysql

The table for this hour? I'm not sure what you mean.
Are you creating tables with a cronjob?
What would an exmaple for a "table for this hour" look like / be named?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #3 (permalink)  
Old Nov 16th, 2007, 08:03
Junior Member
Join Date: Oct 2007
Location: Israel
Age: 21
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Re: passing variables to mysql

very simple
you need to add to your table a time-stamp cell.
then when you want to ask your questions you do it with a SQL statement
select * where `theTime` > time()
http://php.net/manual/en/function.time.php
Reply With Quote
  #4 (permalink)  
Old Nov 16th, 2007, 08:07
Up'n'Coming Member
Join Date: Oct 2007
Location: london
Age: 25
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Re: passing variables to mysql

ahhh... ok cool thanks! Ive got it now!
Reply With Quote
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variables from PHP to Flash tox0tes Flash & Multimedia Forum 4 Dec 29th, 2007 06:46
Passing variables from Flash to PHP LostProphet Flash & Multimedia Forum 6 Aug 31st, 2006 14:05
Passing Variables to a require_once() Page darryladie PHP Forum 3 Jun 20th, 2006 18:36
passing post variables benbacardi PHP Forum 5 Jul 5th, 2005 22:13
PLEASE HELP - Passing Variables in Querystring just_the_basix Classic ASP 40 Sep 3rd, 2004 10:46


All times are GMT. The time now is 22:01.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43