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
 show how many live adverts command

Author  Topic 

tg5769
Starting Member

4 Posts

Posted - 2005-12-11 : 09:56:30
Hi

Please can someone help me with a problem im having.

I have a site which allows users to place adverts, they can place as many as they like.

In dreamweaver I have managed to set up a site which now works fine in testing (early stages), a user can log in with "user" and "password".

I wowuld like to know how it can be done so that when a user logs in, it shows them how many adverts they have running.
Example:
Live adverts = "?"

I can only get as far as knowing that I need to use "count" in the command, how do I do it so it shows only the advertiser who has logged in their results

Thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-12-11 : 11:14:49
well first you have to store the logged on user in cache. either application or session cache.
then you must pass his user name to your db.
in your table you must have a column userName that tells you which advert is from which user.
then you simply do
select count(*) from yourAdTable where username = 'CurrentUserName'

Go with the flow & have fun! Else fight the flow
Go to Top of Page

tg5769
Starting Member

4 Posts

Posted - 2005-12-11 : 11:26:37
Thanks for the reply, if you could, can you please expain in a bit more detail your answer,
How do you apply session cache?
How do I pass username to db?

im ny database I have 1 column for user, 1 column for password and all my other relevent fields, they log in with user and password, I need in more idiots terms...what next?

Thanks
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-12-11 : 11:39:19
well you say it's dreamweaver?
as far as i know that's not a good tool for any serious db access development.
you doing asp or asp.net?
what is session:
http://www.w3schools.com/asp/asp_sessions.asp

how do you access the databse?


Go with the flow & have fun! Else fight the flow
Go to Top of Page

tg5769
Starting Member

4 Posts

Posted - 2005-12-11 : 12:05:32
I am using dreamweaver8, php and mysql.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-12-11 : 12:17:34
well then i think you'd get better answers here:
http://www.dbforums.com/f5

because this is a MS sql server site.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

tg5769
Starting Member

4 Posts

Posted - 2005-12-11 : 12:46:57
Thanks for the link and sorry if I wasted your time!

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-12-11 : 12:59:32
no problem

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -