only one row in the table can have a certain value

This is a discussion on only one row in the table can have a certain value within the PHP Language forums, part of the PHP Programming Forums category; I have a mysql database with a 'feeds' table in it allowing the use to add feeds to their site. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-24-2007
chris_huh
 
Posts: n/a
Default only one row in the table can have a certain value

I have a mysql database with a 'feeds' table in it allowing the use to
add feeds to their site. What i also want is for them to be able to
choose one to show on the homepage (or none), but only one. Is this
possible by having a field in the table called 'homepage' which is set
to 'no' for all but one (at the most). They would then be able to
choose which one to show by a list of all the feeds being generated
and they can select a radio button for that feed.

The only other way i can think of is to have another table with one
row in it which JOINS to the other one, but that may be getting more
messy if they is a simple way with one table.

Reply With Quote
  #2 (permalink)  
Old 03-26-2007
delishus
 
Posts: n/a
Default Re: only one row in the table can have a certain value

On Mar 23, 6:16 pm, "chris_huh" <chris....@gmail.com> wrote:
> I have a mysql database with a 'feeds' table in it allowing the use to
> add feeds to their site. What i also want is for them to be able to
> choose one to show on the homepage (or none), but only one. Is this
> possible by having a field in the table called 'homepage' which is set
> to 'no' for all but one (at the most). They would then be able to
> choose which one to show by a list of all the feeds being generated
> and they can select a radio button for that feed.
>
> The only other way i can think of is to have another table with one
> row in it which JOINS to the other one, but that may be getting more
> messy if they is a simple way with one table.


Assuming I understand what your are after....I'd add another field to
your 'user' table where you store your user information like username,
password etc called feed_id. Whichever feed they select from the radio
button add it to feed_id. Then when you query out your user
information you'll know which feed to pull for them from the 'feeds'
table.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:59 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0