[mysql] requete

ViPHP
ViPHP | 5924 Messages

01 janv. 2008, 17:43

oki je vais coder tout à l'heure un module ou seul moi (connecté) je verrai le temps de chargement de chaque page et le nombre de requêtes exécutés.
Euh, c'eut été mieux de mesurer directement le temps de l'opération que l'on veut tester, pas de la page entière…
-ESt ce que cette requête est bien conçue ?

Code : Tout sélectionner

$retour = mysql_query('SELECT UNIX_TIMESTAMP(p.timestamp), p.zinc, p.mercure, p.oxonium, p.uranium, p.mine_zinc, p.mine_mercure, p.mine_oxonium, p.mine_uranium, p.centrale_oxonium, p.depot_zinc, p.depot_mercure, p.depot_oxonium, p.depot_uranium, p.pourcentage_zinc, p.pourcentage_mercure, p.pourcentage_oxonium, p.pourcentage_uranium, p.centrale_condensation, p.station_solaire, p.tmin, p.tmax FROM planetes p join joueurs j on p.id_joueur=j.id WHERE j.pseudo=\''.$pseudo.'\'');
-Si elle est bien conçu j'ai essayé toute à l'heure de récupérer des infos de la table joueurs en rajoutants les champs j.pseudo, j.conduction dans la sélection des champs juste avant le FROM mais il ne me les sélectionne pas :S
Tu peux donner le schéma de tes tables (sous forme d'exportation CREATE TABLE…).

Eléphanteau du PHP | 12 Messages

01 janv. 2008, 20:23

oki même si elle sont trés grosse mais je ferais comme tu me la conseillé :)

Code : Tout sélectionner

CREATE TABLE IF NOT EXISTS `joueurs` ( `id` int(11) NOT NULL auto_increment, `pseudo` varchar(255) NOT NULL, `mdp` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `version` varchar(255) NOT NULL, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, `galaxie` int(11) NOT NULL, `systeme` int(11) NOT NULL, `position` int(11) NOT NULL, `points_total` int(11) NOT NULL, `points_flotte` int(11) NOT NULL, `points_recherche` int(11) NOT NULL, `points_total_encour` float NOT NULL, `points_flotte_encour` float NOT NULL, `points_recherche_encour` float NOT NULL, `pertes_infliges` int(11) NOT NULL, `pertes_reçu` int(11) NOT NULL, `alliance` varchar(255) NOT NULL, `processique` int(11) NOT NULL, `processique_temps` int(11) NOT NULL, `conduction` int(11) NOT NULL, `conduction_temps` int(11) NOT NULL, `espionnage` int(11) NOT NULL, `espionnage_temps` int(11) NOT NULL, `armes` int(11) NOT NULL, `armes_temps` int(11) NOT NULL, `bouclier` int(11) NOT NULL, `bouclier_temps` int(11) NOT NULL, `blindage` int(11) NOT NULL, `blindage_temps` int(11) NOT NULL, `tritorsion` int(11) NOT NULL, `tritorsion_temps` int(11) NOT NULL, `drivepulsion` int(11) NOT NULL, `drivepulsion_temps` int(11) NOT NULL, `hypertritorsion` int(11) NOT NULL, `hypertritorsion_temps` int(11) NOT NULL, `ions` int(11) NOT NULL, `ions_temps` int(11) NOT NULL, `laser` int(11) NOT NULL, `laser_temps` int(11) NOT NULL, `platinium` int(11) NOT NULL, `platinium_temps` int(11) NOT NULL, `connection_interplanetaire` int(11) NOT NULL, `connectioni_temps` int(11) NOT NULL, `graviton` int(11) NOT NULL, `graviton_temps` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=63 ;

Code : Tout sélectionner

CREATE TABLE IF NOT EXISTS `planetes` ( `id` int(11) NOT NULL auto_increment, `id_joueur` int(11) NOT NULL, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `galaxie` int(11) NOT NULL, `systeme` int(11) NOT NULL, `position` int(11) NOT NULL, `tmin` int(11) NOT NULL, `tmax` int(11) NOT NULL, `diametre` int(11) NOT NULL, `case_util` int(11) NOT NULL, `caset` int(11) NOT NULL, `nom` varchar(255) NOT NULL, `zinc` int(11) NOT NULL, `mercure` int(11) NOT NULL, `oxonium` int(11) NOT NULL, `uranium` int(11) NOT NULL, `mine_zinc` int(11) NOT NULL, `zinc_temps` int(11) unsigned NOT NULL, `mine_mercure` int(11) NOT NULL, `mercure_temps` int(10) unsigned NOT NULL, `mine_oxonium` int(11) NOT NULL, `oxonium_temps` int(11) unsigned NOT NULL, `mine_uranium` int(11) NOT NULL, `uranium_temps` int(10) unsigned NOT NULL, `pourcentage_zinc` int(11) NOT NULL, `pourcentage_mercure` int(11) NOT NULL, `pourcentage_oxonium` int(11) NOT NULL, `pourcentage_uranium` int(11) NOT NULL, `centrale_condensation` int(11) NOT NULL, `central1_temps` int(11) NOT NULL, `centrale_oxonium` int(11) NOT NULL, `central2_temps` int(11) NOT NULL, `station_solaire` int(11) NOT NULL, `temps_stations` int(11) NOT NULL, `depot_zinc` int(11) NOT NULL, `depotz_temps` int(11) NOT NULL, `depot_mercure` int(11) NOT NULL, `depotm_temps` int(11) NOT NULL, `depot_oxonium` int(11) NOT NULL, `depoto_temps` int(11) NOT NULL, `depot_uranium` int(11) NOT NULL, `depotu_temps` int(11) NOT NULL, `centre_scientifique` int(11) NOT NULL, `centres_temps` int(11) NOT NULL, `centre_de_combat` int(11) NOT NULL, `centrec_temps` int(11) NOT NULL, `centre_robotique` int(11) NOT NULL, `centrerobo_temps` int(11) NOT NULL, `usine_robotique` int(11) NOT NULL, `usinerobo_temps` int(11) NOT NULL, `terramodeleur` int(11) NOT NULL, `terramodeleur_temps` int(11) NOT NULL, `reservoir_a_missile` int(11) NOT NULL, `reservoirm_temps` int(11) NOT NULL, `transporteur_gt` int(11) NOT NULL, `transporteur_gt_10` int(11) NOT NULL, `chasseur` int(11) NOT NULL, `chasseur_vipe` int(11) NOT NULL, `cuirasse` int(11) NOT NULL, `destroyer` int(11) NOT NULL, `bomber` int(11) NOT NULL, `forteresse_destructrice` int(11) NOT NULL, `wraper` int(11) NOT NULL, `sonde` int(11) NOT NULL, `convertisseur` int(11) NOT NULL, `colonisateur` int(11) NOT NULL, `lanceur_afx` int(11) NOT NULL, `lanceur_afx_10` int(11) NOT NULL, `laser_canon` int(11) NOT NULL, `tirailleur` int(11) NOT NULL, `cataliseur` int(11) NOT NULL, `lanceur_de_platinium` int(11) NOT NULL, `boucliant` int(11) NOT NULL, `boucliant_10` int(11) NOT NULL, `intersepteur` int(11) NOT NULL, `missile_afx` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;

ViPHP
ViPHP | 5924 Messages

01 janv. 2008, 23:08

Comme je t'ai dit, je te conseillerais de mettre recherches, vaisseaux, et batiments dans des tables à part.

Sinon, pour ta requète, je ne vois pas de problème, tu n'as pas d'erreur sql ? il te sélectionne le reste, et pas ces deux champs là ?

Eléphanteau du PHP | 12 Messages

02 janv. 2008, 00:34

oui mais j'ai résolut le problème c'est bon,
bah merci pour tout tes conseils je vais mettre en application tous tes conseils et je viendrais dire ce qu'il en ait ici quand j'aurais fini :)