By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,825 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,825 IT Pros & Developers. It's quick & easy.

Limit Records created to one only

P: n/a
RT
I have a registration system that Iım working on that requires some
information to be entered only once (ie. Company name, cost & dates)
Does anyone know how I can set up in php so only one record is created in
the mySQL table and never anymore. I also want the end user to be able to
edit this information if needed .
Thanks

RT

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Limit Records created to one only
"RT" <ro******@comcast.net> wrote in message
news:BC96E92F.EEFB%ro******@comcast.net...
I have a registration system that I'm working on that requires some
information to be entered only once (ie. Company name, cost & dates)
Does anyone know how I can set up in php so only one record is created in
the mySQL table and never anymore. I also want the end user to be able to
edit this information if needed .
Thanks

RT

1) No HTML please, we're Usenet.
2) Look up "unique keys". I assume you want a single record per customer, so
you'll have to decide on what makes each customer "unique" (name, customer
ref or something) and make that field UNIQUE when you CREATE the TABLE.
Attempts to INSERT the same key value twice will then fail. You can always
look it up yourself first of course, but this is the SQL way.
3) This isn't a PHP question after all! Aren't you lucky.

Garp
Jul 17 '05 #2

P: n/a
RT
On 4/5/04 6:22 PM, in article
P_*********************@news-text.cableinet.net, "Garp"
<ga***@no7.blueyonder.co.uk> wrote:
Limit Records created to one only
"RT" <ro******@comcast.net> wrote in message
news:BC96E92F.EEFB%ro******@comcast.net...
I have a registration system that I'm working on that requires some
information to be entered only once (ie. Company name, cost & dates)
Does anyone know how I can set up in php so only one record is created in
the mySQL table and never anymore. I also want the end user to be able to
edit this information if needed .
Thanks

RT

1) No HTML please, we're Usenet.
2) Look up "unique keys". I assume you want a single record per customer, so
you'll have to decide on what makes each customer "unique" (name, customer
ref or something) and make that field UNIQUE when you CREATE the TABLE.
Attempts to INSERT the same key value twice will then fail. You can always
look it up yourself first of course, but this is the SQL way.
3) This isn't a PHP question after all! Aren't you lucky.

Garp

Actually I figured it out by placing a query manually into the code only to
look at the first record only. Don't know if this is the right way but it
seems to work.

Thanks for input

RT

Jul 17 '05 #3

P: n/a

"RT" <ro******@comcast.net> wrote in message
news:BC97F28F.F3D2%ro******@comcast.net...
On 4/5/04 6:22 PM, in article
P_*********************@news-text.cableinet.net, "Garp"
<ga***@no7.blueyonder.co.uk> wrote:
Limit Records created to one only
"RT" <ro******@comcast.net> wrote in message
news:BC96E92F.EEFB%ro******@comcast.net...
I have a registration system that I'm working on that requires some
information to be entered only once (ie. Company name, cost & dates)
Does anyone know how I can set up in php so only one record is created in the mySQL table and never anymore. I also want the end user to be able to edit this information if needed .
Thanks

RT

1) No HTML please, we're Usenet.
2) Look up "unique keys". I assume you want a single record per customer, so you'll have to decide on what makes each customer "unique" (name, customer ref or something) and make that field UNIQUE when you CREATE the TABLE.
Attempts to INSERT the same key value twice will then fail. You can always look it up yourself first of course, but this is the SQL way.
3) This isn't a PHP question after all! Aren't you lucky.

Garp

Actually I figured it out by placing a query manually into the code only

to look at the first record only. Don't know if this is the right way but it
seems to work.

Thanks for input

RT


OK, I don't understand what you did, but by the sound of it, neither do you,
and that's storing up problems for later. At the very least, try to find the
company you want to insert first (with SELECT), and don't bother putting it
in if that returns anything.

Best of luck,
Garp
Jul 17 '05 #4

P: n/a
Limit Records created to one only>"RT" <ro******@comcast.net> wrote in
message news:BC96E92F.EEFB%ro******@comcast.net...
I have a registration system that I'm working on that requires some information to be entered only >once (ie. Company name, cost & dates)Does anyone know how I can set up in php so only one record is created in

the mySQL table and >never anymore. I also want the end user to be able to
edit this information if needed .

You would use REPLACE keyword for something like that, I think.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.