<?
$categorie[1] = 'clavier';
$categorie[2] = 'ecran';
$categorie[3] = 'souris';
$categorie[4] = 'webcam';
$categorie[5] = 'boitier';
$categorie[6] = 'cm';
$categorie[7] = 'hd';
$categorie[8] = 'graveur';
$categorie[9] = 'cg';
$categorie[10] = 'bureau';
/*
* ET ON LES REMPLIS
*/
$zcompt2=1;
while($categorie[$zcompt2])
{
echo "compt2 = $zcompt2<br>";
echo "catcompt2 = $categorie[$zcompt2]<br>";
$zcat = $categorie[$zcompt2];
$zcompt=1;
$zreq2 = mysql_query("SELECT * FROM matos_$zcat");
while($zres2 = mysql_fetch_array($zreq2))
{
echo "compt1 = $zcompt<br>";
echo "cat = $zcat<br>";
echo "<pre>";
print_r($zres2);
$$zcat[$zcompt]=$zres2;
$zcompt++;
}
$zcompt2++;
}
?>
voila un petit bout de mon script php, voici les tables SQL dont vous avez besoin :
#
# Structure de la table `matos_boitier`
#
CREATE TABLE `matos_boitier` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;
#
# Contenu de la table `matos_boitier`
#
INSERT INTO `matos_boitier` VALUES (1, 'Advance Kymic 805 B', '44.9', '3');
INSERT INTO `matos_boitier` VALUES (2, 'Advance 8803', '69', '8');
INSERT INTO `matos_boitier` VALUES (3, 'Antec SLK 3700 BQE', '99', '10.6');
INSERT INTO `matos_boitier` VALUES (4, 'Antec P160', '129', '6.5');
INSERT INTO `matos_boitier` VALUES (5, 'AOpen HQ-08A', '103.9', '9');
# --------------------------------------------------------
#
# Structure de la table `matos_bureau`
#
CREATE TABLE `matos_bureau` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`poids` float NOT NULL default '0',
`prix` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
#
# Contenu de la table `matos_bureau`
#
INSERT INTO `matos_bureau` VALUES (1, 'bureau normal', '25', '250');
# --------------------------------------------------------
#
# Structure de la table `matos_cg`
#
CREATE TABLE `matos_cg` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`memoire` int(11) NOT NULL default '0',
`performance` int(11) NOT NULL default '0',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=9 ;
#
# Contenu de la table `matos_cg`
#
INSERT INTO `matos_cg` VALUES (1, 'ATI Radeon 9200 SE 64 Mo DDR', 64, 5, '42.95', '0.6');
INSERT INTO `matos_cg` VALUES (2, 'ATI Radeon 9200 SE 128 Mo DDR', 128, 9, '51.55', '0.65');
INSERT INTO `matos_cg` VALUES (3, 'NVIDIA Geforce 2 MX400 64Mo', 64, 4, '39.95', '0.3');
INSERT INTO `matos_cg` VALUES (4, 'NVIDIA Geforce MX 4000 - 128 Mo', 128, 6, '53.95', '0.4');
INSERT INTO `matos_cg` VALUES (5, 'NVIDIA GeForce FX 5200 - 128 Mo', 128, 7, '59.95', '0.5');
INSERT INTO `matos_cg` VALUES (6, 'NVIDIA GeForce FX 5700 LE - 128 Mo', 128, 9, '109.95', '0.3');
INSERT INTO `matos_cg` VALUES (7, 'NVIDIA GeForce FX 5600XT - 256 Mo', 256, 11, '114.95', '0.4');
INSERT INTO `matos_cg` VALUES (8, 'NVIDIA GeForce FX 5600XT - 256 Mo', 256, 11, '114.95', '0.4');
# --------------------------------------------------------
#
# Structure de la table `matos_clavier`
#
CREATE TABLE `matos_clavier` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`prix` float NOT NULL default '0',
`fil` enum('true','false') NOT NULL default 'true',
`OS` enum('1','2','12') NOT NULL default '1',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;
#
# Contenu de la table `matos_clavier`
#
INSERT INTO `matos_clavier` VALUES (1, 'Memorex MX5000 105 Touches', '12', 'true', '12', '0.9');
INSERT INTO `matos_clavier` VALUES (2, 'Keytronic KT 2001 AZERTY', '39', 'true', '12', '1');
INSERT INTO `matos_clavier` VALUES (3, 'Trust Easy Scroll SILVERLINE', '19.95', 'true', '1', '1.2');
INSERT INTO `matos_clavier` VALUES (4, 'Advance Clavier Small Touch', '26.99', 'false', '1', '0.65');
# --------------------------------------------------------
#
# Structure de la table `matos_cm`
#
CREATE TABLE `matos_cm` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`for` enum('amd','intel') NOT NULL default 'amd',
`poids` float NOT NULL default '0',
`prix` float NOT NULL default '0',
`agp` enum('true','false') NOT NULL default 'true',
`pci` tinyint(2) NOT NULL default '0',
`ram` tinyint(2) NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=6 ;
#
# Contenu de la table `matos_cm`
#
INSERT INTO `matos_cm` VALUES (1, 'PC CHIPS Carte Mère M811LU', 'amd', '3.5', '27.95', 'true', 5, 2);
INSERT INTO `matos_cm` VALUES (2, 'ELITE Carte mère Elite L7S7A2', 'amd', '4', '31.95', 'true', 5, 3);
INSERT INTO `matos_cm` VALUES (3, 'ASUSTEK Carte mère Asustek A7N8X-E Deluxe', 'amd', '3.5', '104.1', 'true', 5, 3);
INSERT INTO `matos_cm` VALUES (4, 'ASUSTEK Carte mère Asustek P4PE-X', 'intel', '4', '69.95', 'true', 6, 3);
INSERT INTO `matos_cm` VALUES (5, 'ASUSTEK Carte mère Asustek P4P800-E-Deluxe', 'intel', '4.5', '126.1', 'true', 5, 4);
# --------------------------------------------------------
#
# Structure de la table `matos_ecran`
#
CREATE TABLE `matos_ecran` (
`id` int(11) NOT NULL auto_increment,
`type` enum('crt','lcd') NOT NULL default 'crt',
`nom` varchar(100) NOT NULL default '',
`size` int(11) NOT NULL default '0',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=8 ;
#
# Contenu de la table `matos_ecran`
#
INSERT INTO `matos_ecran` VALUES (1, 'crt', 'iiyama LS502U', 15, '129', '12.5');
INSERT INTO `matos_ecran` VALUES (2, 'crt', 'Hyundai DeluxScan V773', 17, '119', '13.5');
INSERT INTO `matos_ecran` VALUES (3, 'crt', 'Hyundai ImageQuest Q995', 19, '209', '20');
INSERT INTO `matos_ecran` VALUES (4, 'crt', 'Hyundai ImageQuest F230', 21, '529', '25');
INSERT INTO `matos_ecran` VALUES (5, 'lcd', 'Acer AL1512M', 21, '376', '2.6');
INSERT INTO `matos_ecran` VALUES (6, 'lcd', 'Belinea 10 17 10', 17, '425', '4.5');
INSERT INTO `matos_ecran` VALUES (7, 'lcd', 'iiyama PLE511S-W', 17, '1299', '8.2');
# --------------------------------------------------------
#
# Structure de la table `matos_graveur`
#
CREATE TABLE `matos_graveur` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`ecriture` int(11) NOT NULL default '0',
`reecriture` int(11) NOT NULL default '0',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;
#
# Contenu de la table `matos_graveur`
#
INSERT INTO `matos_graveur` VALUES (1, 'Lite-On LTR-52327', 52, 32, '33.99', '1');
INSERT INTO `matos_graveur` VALUES (2, 'Asus CDRW 5224A', 52, 24, '38.99', '0.9');
INSERT INTO `matos_graveur` VALUES (3, 'Plextor PlexWriter 52/24/52A', 52, 24, '67.99', '0.5');
INSERT INTO `matos_graveur` VALUES (4, 'Plextor PlexWriter Premium 52/32/52', 52, 32, '94.99', '450');
# --------------------------------------------------------
#
# Structure de la table `matos_hd`
#
CREATE TABLE `matos_hd` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`capacité` int(11) NOT NULL default '0',
`cache` int(11) NOT NULL default '0',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=13 ;
#
# Contenu de la table `matos_hd`
#
INSERT INTO `matos_hd` VALUES (1, 'Maxtor DiamondMax plus8 - 40', 40, 2, '52.99', '1');
INSERT INTO `matos_hd` VALUES (2, 'Maxtor DiamondMax Plus9 - 120 - 8', 120, 8, '94.45', '1');
INSERT INTO `matos_hd` VALUES (3, 'Western Digital Caviar 1600JB SE', 160, 8, '114.89', '1');
INSERT INTO `matos_hd` VALUES (4, 'Western Digital Caviar 2000JB SE', 200, 8, '148.99', '1');
INSERT INTO `matos_hd` VALUES (5, 'Maxtor DiamondMax Plus9 - 120', 120, 2, '87', '1');
INSERT INTO `matos_hd` VALUES (6, 'Maxtor DiamondMax Plus9 - 160 - 8', 160, 8, '98.99', '1');
INSERT INTO `matos_hd` VALUES (7, 'Maxtor DiamondMax Plus9 - 200 - 8', 200, 8, '131.99', '1');
INSERT INTO `matos_hd` VALUES (8, 'Maxtor DiamondMax Plus9 - 250 - 8', 250, 8, '204.99', '1');
INSERT INTO `matos_hd` VALUES (9, 'Seagate Barracuda 7200.7 - 80', 80, 2, '69.89', '1');
INSERT INTO `matos_hd` VALUES (10, 'Seagate Barracuda 7200.7 Plus - 120', 120, 8, '96.35', '1');
INSERT INTO `matos_hd` VALUES (11, 'Seagate Barracuda 7200.7 Plus - 160', 160, 8, '114.95', '1');
INSERT INTO `matos_hd` VALUES (12, 'Maxtor MaXLine II - 300', 300, 2, '278.19', '1');
# --------------------------------------------------------
#
# Structure de la table `matos_os`
#
CREATE TABLE `matos_os` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`type` enum('1','2') NOT NULL default '1',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=13 ;
#
# Contenu de la table `matos_os`
#
INSERT INTO `matos_os` VALUES (1, 'Microsoft Windows 98', '1');
INSERT INTO `matos_os` VALUES (2, 'Microsoft Windows 98 se', '1');
INSERT INTO `matos_os` VALUES (3, 'Microsoft Windows 2000', '1');
INSERT INTO `matos_os` VALUES (4, 'Microsoft Windows XP Home', '1');
INSERT INTO `matos_os` VALUES (5, 'Microsoft Windows XPPro', '1');
INSERT INTO `matos_os` VALUES (6, 'Mandrake Linux', '2');
INSERT INTO `matos_os` VALUES (7, 'GNU/Linux Debian', '2');
INSERT INTO `matos_os` VALUES (8, 'Red Hat', '2');
INSERT INTO `matos_os` VALUES (9, 'Fedora', '2');
INSERT INTO `matos_os` VALUES (10, 'slackware', '2');
INSERT INTO `matos_os` VALUES (11, 'SuSE', '2');
INSERT INTO `matos_os` VALUES (12, 'Gentoo', '2');
# --------------------------------------------------------
#
# Structure de la table `matos_souris`
#
CREATE TABLE `matos_souris` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`roulette` enum('true','false') NOT NULL default 'true',
`fil` enum('true','false') NOT NULL default 'true',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
`os` enum('1','2','12') NOT NULL default '1',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;
#
# Contenu de la table `matos_souris`
#
INSERT INTO `matos_souris` VALUES (1, 'Trust AMI Mouse Serial', 'false', 'true', '2.95', '0.25', '12');
INSERT INTO `matos_souris` VALUES (2, 'Microsoft Trekker', 'false', 'true', '4.9', '0.25', '12');
INSERT INTO `matos_souris` VALUES (3, 'Microsoft Trekker Wheel', 'true', 'true', '8', '0.35', '12');
INSERT INTO `matos_souris` VALUES (4, 'Itron Lynx M7', 'true', 'false', '15.99', '0.3', '1');
# --------------------------------------------------------
#
# Structure de la table `matos_webcam`
#
CREATE TABLE `matos_webcam` (
`id` int(11) NOT NULL auto_increment,
`nom` varchar(100) NOT NULL default '',
`resolution` varchar(10) NOT NULL default '',
`prix` float NOT NULL default '0',
`poids` float NOT NULL default '0',
KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=5 ;
#
# Contenu de la table `matos_webcam`
#
INSERT INTO `matos_webcam` VALUES (1, 'Logitech QuickCam Express', '320x240', '32.9', '0.5');
INSERT INTO `matos_webcam` VALUES (2, 'Labtec Webcam', '352 x 288', '17.9', '0.25');
INSERT INTO `matos_webcam` VALUES (3, 'Creative WebCam NX Pro', '640x480', '51.95', '0.65');
INSERT INTO `matos_webcam` VALUES (4, 'Logitech QuickCam For Notebook Pro', '640x480', '98', '0.7');
or mon script ne marche pas, car les array comme $ecran[1] etc sont vide
Comprennez vous pourquoi ?
NB : tout les echo dans mon script sont la pour m'aider a localiser l'erreur, il ne servent a rien d'autre, donc dans la version finales, je les virerai
-Edité le Samedi 21 août 2004 à 11:32 par matth-