-2
I am creating an online draw system in PHP and Mysql. First I create the draw where I inform the prize and its details, among them the amount of coupons, beginning at a specific number. To put it simply, I’m going to draw a car and sell 800 numbers, which should start at 101 and go up to 900 (101, 102, 103, ...899, 900). In another table, I need to generate these numbers automatically, and in each of them I will have the name of the buyer of this number, phone and email, which will be completed later. How do I generate this sequence and write to the database? The table looks like this:
CREATE TABLE `numeros` (
`id` int(11) NOT NULL,
`rifa` varchar(50) NOT NULL,
`numero` decimal(8,0) NOT NULL,
`status` varchar(50) NOT NULL,
`nome` varchar(250) NOT NULL,
`celular` varchar(50) NOT NULL,
`email` varchar(250) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Only the number field should be generated at this stage, besides id, of course. I have tried several ways, I could not. I know your help.
you want to generate the numbers that won the awards?
– rray
I think the problem is that you declare all fields as
not null
.. if you just want to fill out the number, the rest will stay null, no?! if yes, can’t benot null
..– rLinhares
I don’t think I’ve been understood. I need a script that automatically fills the number and raffle field (which will be informed through an array) only, massively in sequence (101, 102, 03, until the end 899, 900). After that, the person will select the number and fill in her data and start to compete with that number.
– Wagner EstilloWeb
But then, in question you say that only the field number should be generated and in comment the field number and raffle. Number is the sequence from 101 to 900 and raffle as it would be?
– user60252