Accès au manager - réservé aux membres

Navigation

Bouts de Codes MySQL

Mysql comme PHPMyAdmin

Informations sur le code source MySQL

Ecrit par :  Lion
Site de l'auteur Voir
Date d'enregistrement du code le 03 Oct 2007 - Vu 2145 fois
Code source zippé: Télécharger le fichier ZIP
Impression: Imprimer le code
Ajouter la page à vos favoris

Description du code source

Informations sur le code source

Affiche les résultats d'une requete Mysql comme dans PHPMyAdmin

Code Source



.01
.02
.03
.04
.05
.06
.07
.08
.09
.10
.11
.12
.13
.14
.15
.16
.17
.18
.19
.20
.21
.22
.23
.24
.25
.26
.27
.28
.29
.30
.31
.32
.33
.34
.35
.36
.37
.38
.39
.40
.41
.42
.43
.44
.45
.46
.47
.48
.49
.50
.51
.52
.53
.54
 

<?php
/******************************************************************************/
/*                                                                            */
/*                       __        ____                                       */
/*                 ___  / /  ___  / __/__  __ _____________ ___               */
/*                / _ \/ _ \/ _ \_\ \/ _ \/ // / __/ __/ -_|_-<               */
/*               / .__/_//_/ .__/___/\___/\_,_/_/  \__/\__/___/               */
/*              /_/       /_/                                                 */
/*                                                                            */
/*                                                                            */
/******************************************************************************/
/*                                                                            */
/* Titre          : Mysql comme PHPMyAdmin                                    */
/*                                                                            */
/* URL            : http://www.phpsources.org/scripts17-MySQL.htm             */
/* Auteur         : Lion                                                      */
/* Date édition   : 03 Oct 2007                                               */
/* Website auteur : http://www.phpsources.org                                 */
/*                                                                            */
/******************************************************************************/


$requete '...';

mysql_connect('serveur''login''pass');
mysql_select_db('bdd');

/******************************************************/

$res mysql_query($requete) or exit(mysql_error());

echo '<table border="1"><tr>';

for ($i 0$i mysql_num_fields($res); $i++) {
    echo '<th>';
    echo mysql_field_name($res$i);
    echo '</th>';
}

echo '</tr>';

while ($row mysql_fetch_row($res)) {
    echo '<tr>';
   
    for ($j 0$j count($row); $j++) {
        echo '<td>';
        echo ($row[$j] == NULL) ? '<i>NULL</i>' $row[$j];
        echo '</td>';
    }
   
    echo '</tr>';
}


Fonctions du code source

Fonctions php / mysql MySQL

  • mysql_connect : Ouvre une connexion à un serveur MySQL - (PHP 4, PHP 5, PECL mysql:1.0)
  • mysql_select_db : Sélectionne une base de données MySQL - (PHP 4, PHP 5, PECL mysql:1.0)
  • exit : Affiche un message et termine le script courant - (PHP 4, PHP 5)
  • mysql_error : - (PHP 4, PHP 5, PECL mysql:1.0)
  • mysql_query : Envoie une requête à un serveur MySQL - (PHP 4, PHP 5, PECL mysql:1.0)
  • echo : Affiche une chaîne de caractères - (PHP 4, PHP 5)
  • mysql_num_fields : Retourne le nombre de champs d'un résultat MySQL - (PHP 4, PHP 5, PECL mysql:1.0)
  • mysql_field_name : Retourne le nom d'une colonne dans un résultat MySQL - (PHP 4, PHP 5, PECL mysql:1.0)
  • mysql_fetch_row : Retourne une ligne de résultat MySQL sous la forme d'un tableau - (PHP 4, PHP 5, PECL mysql:1.0)
  • count : Compte le nombre d'éléments d'un tableau ou le nombre de propriétés d'un objet - (PHP 4, PHP 5)

Poster un commentaire

:P :) :wink: :lol: :surprised: :confused: :mad: :no:
Taille du texte:
Couleur:
Code de sécurité

Les dernières offres d'emploi