Problem need help Urgently...

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
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

Problem need help Urgently...

Post by shinstar »

Helloo ever one i need know In PHP the function giving the current time stamp value is time(). So we can write a line like below to get the current time stamp value.

<? echo time(); ?>

my Question is how to display any value on specific time( where value is stored in database )...
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Problem need help Urgently...

Post by fugix »

you could set up an if function using the time() or now() function with a specific format and set it equal to the time that you want to show the data (using the same format as in the time() function)
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

Re: Problem need help Urgently...

Post by shinstar »

Thanks for reply but , what will i do if i want to show data like this format,

e.g Time Value
10:00 am ( value here from database which is saved before )
10:30 am ( value here from database which is saved before ) and so on....please guide me thanks
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Problem need help Urgently...

Post by fugix »

Code: Select all

if (time($format)==10:00am) {
     echo "10:00am(" . $database_info . ")";
}
are you talking about something like that?
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

Re: Problem need help Urgently...

Post by shinstar »

yes this is it but ,
i just want to display some value which is stored before on a specific time of server, e.g

if server current time is,

10:00 am ( then display my value which is stored before)
when time goes to ,
10:30 am ( then display next value which is stored before)


this process is continued till the values stored in the data base is finished..
hope you understand...
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Problem need help Urgently...

Post by fugix »

then you would put the if function into a while loop
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

Re: Problem need help Urgently...

Post by shinstar »

ok thanks but tell me in code

if (time($format)==10:00am) {
echo "10:00am(" . $database_info . ")";
}

what is $database_info come from?

i just want to display the values form database which i have saved before in table and just want to be displayed when specific time comes as i told above in e.g

if i have stored some thing like value let say ( 10,20,30,40 and so on ) in database
now i just want a php code to display it on site but on specific time only like this,

if time = 10:00am display value = 10
when time = 10:30am display value = 20
when time = 11:00am display value = 30

and so own simple...
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Problem need help Urgently...

Post by fugix »

$database_info is whatever info that you want to be shown...you would name that variable whatever you want.

while(time($format)==10:00am) {
//code
}
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

Re: Problem need help Urgently...

Post by shinstar »

ok what should i do if i want to display the record like this with data and time both,
database value is 10,20,30,40
Site output should be like this let say,

date-------------------time-------------------value
12-04-11--------------3:00 pm---------------10
12-04-11--------------3:30 pm---------------20
12-04-11--------------4:00 pm---------------30
12-04-11--------------4:30 pm---------------40

give me code thanks with comments
fugix
Forum Contributor
Posts: 207
Joined: Fri Mar 18, 2011 8:01 pm

Re: Problem need help Urgently...

Post by fugix »

why are you trying to do things like this when you have clearly not learned enough? walk before you can run my friend. take some time to learn alot about PHP before trying to do things you do not understand.
Post Reply