I'm having a problem. What I want to do and I'm trying to achieve is a menu where it brings as "main link / s" the categories eg: "Video card" And that when you click, show the video plate marks. Ex:
No Click: Video Plaque
1st Click: MSI
2nd click 1GB - 2GB - 4GB - 8GB
(in the future I want to implement this from the 2nd click / 2nd hover).
Here I have the code with the query sql + php:
<?php
$consulta = "SELECT * FROM categorias";
$consulta2 = "SELECT * FROM marcas";
$filas = mysqli_query($cnx, $consulta);
while( $columnas = mysqli_fetch_assoc($filas) ){
$filas2 = mysqli_query($cnx, $consulta2);
while( $columnas2 = mysqli_fetch_assoc($filas2) ){
?>
<li class="sub-miz">
<a href="#">
<?php echo $columnas['categoria']; ?></a>
<ul>
<li><a href="#"><?php echo $columnas2['marca']; ?></a></li>
</ul>
</li>
[1]: link "first example",
[2]: link "second example",
This is what I want to achieve:
[3] link "trying this"
I want each category to have a name and within the brands of the category type.
As I said above EXAMPLE:
Placa Video > MSI
Placa Madre > MSI
Procesadores > Intel
> AMD
Fuentes > Sentey
Thank you in advance.
Jukxz
EDIT:
Database:
CREATE TABLE 'marcas' (
'id_marca' int(50) NOT NULL,
'marca' varchar(50) NOT NULL,
'categoria' varchar(50) NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO 'marcas' ('id_marca', 'marca') VALUES
(1, 'AMD'),
(2, 'ASUS'),
(3, 'INTEL'),
(4, 'NVIDIA'),
(5, 'MSI'),
(6, 'LOGITECH'),
(7, 'ROG'),
(14, 'GENIUS'),
(15, 'SAMSUNG'),
(16, 'RAZER'),
(17, 'CORSAIR'),
(18, 'ROSEWILL'),
(19, 'EVGA'),
(20, 'GIGABYTE');
CREATE TABLE 'categorias' (
'id_categoria' int(50) NOT NULL,
'categoria' varchar(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO 'categorias' ('id_categoria', 'categoria') VALUES
(1,'Placas de Video');
ALTER TABLE 'categorias'
ADD PRIMARY KEY ('id_categoria'),
ADD UNIQUE KEY 'id_categoria' ('id_categoria'),
ADD KEY 'categoria' ('categoria');
ALTER TABLE 'marcas'
ADD PRIMARY KEY ('id_marca'),
ADD UNIQUE KEY 'id_marca' ('id_marca');
ALTER TABLE 'categorias'
MODIFY 'id_categoria' int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE 'marcas'
MODIFY 'id_marca' int(50) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
ALTER TABLE 'marcas'
ADD CONSTRAINT 'cat_key' FOREIGN KEY ('categoria') REFERENCES 'categorias'
('categoria') ON DELETE CASCADE ON UPDATE CASCADE;