Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Need advice on Sending out Serails to Unique Users
Old 01-14-2010, 04:51 AM Need advice on Sending out Serails to Unique Users
Junior Talker

Posts: 2
Trades: 0
I want to send out serials that I have already generated out to the users that download the software. Only one serial per customer.

I have an idea for the table

serial | inUse | email
412347129 0 yourmail@mail.com

So when a client registers his name and email it will get stored in a table.

the php script will call a random serial form the database and set the "inUse" field of that serial to "1" and also update the email field with the new user email. This is to see that the serial is in use and that the serial belongs to a certain customer email.

So every time a new customer registers, the php script will pull a random serial from the db and check that it's not in use and send it to that customer and then register it again to the new customer.
---------------------------------------------------------------------

What I would like to know if this is a good way of doing this and are there alternative ways. Just remember that the serials are already there.

Thanks in advance.
holla22 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-14-2010, 07:26 AM Re: Need advice on Sending out Serails to Unique Users
Stephen.'s Avatar
Average Talker

Posts: 22
Name: Stephen
Trades: 0
Wouldn't it be simpler to do something along the lines of.

$serial = mt_rand(000000000,999999999);
mysql_query("INSERT into `serials` (`serial`, `email`) VALUES('$serial', '$email')");

Then instead of having to input loads, or even create a script to generate loads which will take up a lot of your database space. Why not just do it so it only inputs ones in use, if they input a serial that is not in the table then it just refuses access?

Obviously you're going to want to add in an if statement to make sure it is unique. I can post that if you want too just figured you wouldn't need it as it's simple stuff

Hope this helps.
__________________
Did I help you? If so add to my Talkupation! =]
Stephen. is offline
Reply With Quote
View Public Profile
 
Old 01-14-2010, 07:35 AM Re: Need advice on Sending out Serails to Unique Users
Junior Talker

Posts: 2
Trades: 0
Hi there

Thanks for the reply. The problem is I have a windows based exe ebooks software, it generates it's own serials. So all I do is import the serials in to the db.

So now all I need is to pull out a random serial that is not in use and send it to the new user. The new users email will be saved according to the serial.

Actually it's kind of simple, I just need the serials to be send out and I need to know which serial belongs to which user in the end.

I figured it would be easy, was just wondering if someone else had a better solution for me.

Thanks for the help, really appreciated
holla22 is offline
Reply With Quote
View Public Profile
 
Old 01-14-2010, 09:04 AM Re: Need advice on Sending out Serails to Unique Users
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
"SELECT serialno FROM table WHERE used = false;"

Give the user the first record returned.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Need advice on Sending out Serails to Unique Users
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25457 seconds with 12 queries