I am creating a system where the user informs the name and time of birth. I wonder if you can solve the following question: I have the following table:
Havingthenameandtimeofbirth,thesystemadministratorinformsthepriorityofeachrecord,being:
1=veryhighpriority,2=priority,3=lowpriority,4=non-priority.ThenIwanttheserecordstobedisplayedinorderofpriority,and2in2.Example:2priorityrecords1...then2priorityrecords2...twopriority3...etcNo,itneedstobeinthesameselect,itcouldusemorethanoneselect,butaslongastherearerecords,Ineedtolist2in2withoutrepeatingthem.Itwouldlooklikethis:
I'm using MySql and Php. Anyone have any idea how I can do this? Thanks!
Follow the mysql table:
CREATE TABLE 'tbl_nasc_users' (
'id' int(111) NOT NULL,
'nome' varchar(30) NOT NULL,
'hr_nasc' time NOT NULL,
'prioridade' int(9) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO 'tbl_nasc_users' ('id', 'nome', 'hr_nasc', 'prioridade') VALUES
(1, 'Pedro', '17:34:40', 1),
(2, 'João', '17:23:18', 2),
(3, 'Marcos', '17:56:39', 2),
(4, 'Vinicius', '18:12:48', 1),
(5, 'Miguel', '18:36:53', 3),
(6, 'Bruno', '18:30:10', 4),
(7, 'Felipe', '18:48:42', 3),
(8, 'Antonio', '19:34:40', 1),
(9, 'Victor', '19:23:18', 2),
(10, 'Ronaldo', '19:56:39', 2),
(11, 'Ricardo', '20:12:48', 1),
(12, 'Teodoro', '20:36:53', 3),
(13, 'Gabriel', '21:30:10', 4),
(14, 'Patrick', '22:48:42', 3);
ALTER TABLE 'tbl_nasc_users'
ADD PRIMARY KEY ('id');
ALTER TABLE 'tbl_nasc_users'
MODIFY 'id' int(111) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;