<?php
/**
* @page connexion_mysql.phpp
* @brief Exemple de connexion à une base MySql Server
*
* @author hughes monget
* @see http://monget.com/
*/
error_reporting(0);
highlight_file(__FILE__);
echo '<hr />';
($res_bd = mysql_connect('localhost', 'toto', 'toto')) || exit('mysql_connect:'.mysql_error());
mysql_select_db('cdes_intranet', $res_bd) || exit('mysql_select_db:'.mysql_error());
($res_result = mysql_query('select id_individu, nom_individu, prenom_individu from individu')) || exit('mysql_query:'.mysql_error());
if (mysql_num_rows($res_result))
{
echo '<pre>';
while ($arr_ligne = mysql_fetch_assoc($res_result, MYSQL_ASSOC))
{
echo $arr_ligne['id_individu'].' '.$arr_ligne['nom_individu'].' '.$arr_ligne['prenom_individu']."\n";
}
echo '</pre>';
}
mysql_free_result($res_result);
mysql_close($res_bd);
echo microtime();