[réglé] mysql_query : problème de syntaxe ou de table: le ré
Posté : 08 avr. 2008, 19:18
Bonjour,
peut être pourrez vous m'aider :
Table climat (en partie seulement)
Bizarre, non ?
voici les informations demandées par le forum
-- Version du serveur: 4.1.9
-- Version de PHP: 4.3.10
CREATE TABLE `climat` (
`key` tinyint(4) NOT NULL auto_increment,
`min` tinyint(3) NOT NULL default '0',
`max` tinyint(3) NOT NULL default '0',
`climat` longtext NOT NULL,
`froide` longtext NOT NULL,
`froide_anormal_min` tinyint(3) NOT NULL default '0',
`froide_anormal_max` tinyint(3) NOT NULL default '0',
`temperee` longtext NOT NULL,
`temperee_anormal_min` tinyint(3) NOT NULL default '0',
`temperee_anormal_max` tinyint(3) NOT NULL default '0',
`desert` longtext NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
Solution : remplacer key par id
peut être pourrez vous m'aider :
Table climat (en partie seulement)
Code : Tout sélectionner
key (tinyint, primary) min
1 0
2 15
3 50
$res = mysql_query("SELECT * FROM climat WHERE min='0'") or die("pb !!");
while($row = mysql_fetch_array($res))
{
echo $row['key'] ;
echo "<br />";
}
récupère la bonne ligne, c'est à dire celle où min=0$res = mysql_query("SELECT * FROM climat WHERE key='1'") or die("pb !!");
while($row = mysql_fetch_array($res))
{
echo $row['key'] ;
echo "<br />";
}
ne récupère rien !Bizarre, non ?
voici les informations demandées par le forum
-- Version du serveur: 4.1.9
-- Version de PHP: 4.3.10
CREATE TABLE `climat` (
`key` tinyint(4) NOT NULL auto_increment,
`min` tinyint(3) NOT NULL default '0',
`max` tinyint(3) NOT NULL default '0',
`climat` longtext NOT NULL,
`froide` longtext NOT NULL,
`froide_anormal_min` tinyint(3) NOT NULL default '0',
`froide_anormal_max` tinyint(3) NOT NULL default '0',
`temperee` longtext NOT NULL,
`temperee_anormal_min` tinyint(3) NOT NULL default '0',
`temperee_anormal_max` tinyint(3) NOT NULL default '0',
`desert` longtext NOT NULL,
PRIMARY KEY (`key`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
Solution : remplacer key par id