Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Count Time and Print into page

Author  Topic 

sizartha
Starting Member

5 Posts

Posted - 2011-12-22 : 13:43:57
Hi SQLteam guys
I'm new to SQL
so, I think, I'll made lots of mistakes in explaining

I have some question about SQL
and I couldn't found forum and such site in my country, answering my questions

At first i have to describe a little about my issue
I have a chat room in my site
and it's based on PHP,SQL,JS
it's connected to a SQL Server within a config.php file

In some other chat rooms (same script) they made some changes, in order to compute how many hours users are online

lets come back to my question

In my Phpmyadmin there is a db named (chat)
and it has to table (there are more but i insinuate only 2 of them)
one of them is chat_users
and the another one is chat_user_online

When a user register in my chat room
The data will send to that table chat_users
and data feel up the field of that user !

At first i want to make a new field in chat_users, for each user
with name "online time"

And make another field for table chat_user_online, for each online user
with name "online time" again !

And then made my chat_user_online to count
how much time The user was online

and add the chat_user_online 'online time' simultaneously to chat_users 'online time'


e.g : if a user was entirely online about 2:30 hours before
and now it's online for another 30 minutes
add this 30 minutes to 2:30 hours ...

i would be really happy if you help me
sorry, it was my first English post !!!!!
and i know i made a lot of mistakes
regards
sassan d.farahani

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-22 : 13:52:47
Please POST THE DDL of the Table

Sample DATA in DML Form

And what the expected results should be

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

sizartha
Starting Member

5 Posts

Posted - 2011-12-22 : 14:14:04
quote:
Originally posted by X002548

Please POST THE DDL of the Table

Sample DATA in DML Form

And what the expected results should be

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/







i dont know what do you mean by
"Please POST THE DDL of the Table
Sample DATA in DML Form
And what the expected results should be
"?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2011-12-22 : 14:15:14
how can we give you an answer if we don't have some code

Read the hint link in my Sig

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

sizartha
Starting Member

5 Posts

Posted - 2011-12-22 : 16:48:19
My question is, how to make DDL
I told you That I'm really new to SQL and i know just a little
can i possibly export my SQL to Zip file and upload it somewhere and give you the link ?
is it possible ?
Regars
Go to Top of Page

sizartha
Starting Member

5 Posts

Posted - 2011-12-23 : 04:15:37
hi
here is my DDL;

chat_users DDL

CREATE TABLE `db1_etchat_user` (
`etchat_user_id` int(8) NOT NULL AUTO_INCREMENT,
`etchat_username` varchar(200) NOT NULL,
`etchat_userpw` varchar(40) DEFAULT NULL,
`etchat_userprivilegien` varchar(15) NOT NULL DEFAULT 'gast',
`etchat_usersex` varchar(1) NOT NULL DEFAULT 'n',
`etchat_reg_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`etchat_reg_ip` varchar(20) DEFAULT NULL,
PRIMARY KEY (`etchat_user_id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;






chat_user_online table DDL

CREATE TABLE `db1_etchat_useronline` (
`etchat_onlineid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`etchat_onlineuser_fid` int(8) NOT NULL,
`etchat_onlinetimestamp` bigint(20) NOT NULL,
`etchat_onlineip` varchar(255) NOT NULL,
`etchat_fid_room` int(11) NOT NULL DEFAULT '1',
`etchat_user_online_room_goup` int(6) NOT NULL,
`etchat_user_online_room_name` varchar(100) NOT NULL,
`etchat_user_online_user_name` varchar(200) NOT NULL,
`etchat_user_online_user_priv` varchar(20) NOT NULL,
`etchat_user_online_user_sex` varchar(1) NOT NULL,
`etchat_user_online_user_status_img` varchar(200) DEFAULT NULL,
`etchat_user_online_user_status_text` varchar(200) DEFAULT NULL,
PRIMARY KEY (`etchat_onlineid`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;


and honestly i know nothing about DML and what my tables should be look like
Regards
sassan d.farahani
Go to Top of Page

sizartha
Starting Member

5 Posts

Posted - 2011-12-23 : 16:53:19
there's nobody answering my questions ?
i thought it's very simple ...
Go to Top of Page
   

- Advertisement -