le 11/05/2007 à 09:12
manzane
merci beaucoup :)
<?php
$sql = 'SELECT COUNT(*) FROM entreprise WHERE `NumSIREN` = "' . mysql_real_escape_string($_POST['NumSIREN'] . '"';
$query = mysql_query($sql) or die('Erreur SQL !<br />Veuillez contacter l\'administreur du service.'.mysql_error());
$donnee = mysql_fetch_row($query);
if($donnee[0] > 0) {
echo 'L\'entreprise existe';
}
else echo 'non';
<?php
$sql = 'SELECT COUNT(*) FROM entreprise WHERE `NumSIREN` = "' . mysql_real_escape_string($_POST['NumSIREN'] . '" OR `NomEntreprise` = "' . mysql_real_escape_string($_POST['NomEntreprise'] . '"';
?>
<? require 'connexion.php';
$conn=mysql_connect($host,$utilisateur,$pwd);
mysql_select_db($base,$conn); ?>
<html>
<head>
<title>Entreprise</title>
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="design.css" />
</head>
<body><?
$nom=$_POST['NomEntreprise'];
$num=$_POST['NumSIREN'];
if (empty($nom))
{
$sql = ("select count(*) as nb, NumSIREN from entreprise where NumSIREN= $num GROUP BY NumSIREN");
}
if (empty($num))
{
$sql = ("select count(*) as nb, NomEntreprise from entreprise where NomEntreprise=" . "'".$nom."' GROUP BY NomEntreprise");
}
echo $sql;
$reponse = @mysql_query($sql) or die('Erreur SQL !<br />Veuillez contacter l\'administreur du service.'.mysql_error());
echo $reponse['nb'];
if (!$reponse)
{
echo "existe pas";
}
else{ ?>
<TABLE border="1" bordercolor="#000000" cellspacing="1" cellpadding="3" width="65%" align="center">
<TR>
<TD class="txt" align="center">
<b>IdEntreprise</b>
</TD>
<TD class="txt" align="center">
<b>N°SIREN</b>
</TD>
<TD class="txt" align="center">
<b>N°SIRET</b>
</TD>
<TD class="txt" align="center">
<b>Nom Entreprise</b>
</TD>
<TD class="txt" align="center">
<b>Adresse Geographique</b>
</TD>
<TD class="txt" align="center">
<b>CP</b>
</TD>
<TD class="txt" align="center">
<b>Ville Geographique</b>
</TD>
<TD class="txt" align="center">
<b>Adresse Postale</b>
</TD>
<TD class="txt" align="center">
<b>Cedex</b>
</TD>
<TD class="txt" align="center">
<b>Ville Postale</b>
</TD>
<TD class="txt" align="center">
<b>N°Telephone</b>
</TD>
<TD class="txt" align="center">
<b>Fax</b>
</TD>
<TD class="txt" align="center">
<b>E-mail</b>
</TD>
<TD class="txt" align="center">
<b>Site Web</b>
</TD>
<TD class="txt" align="center">
<b>Effectif</b>
</TD>
<TD class="txt" align="center">
<b>Code APE</b>
</TD>
<TD class="txt" align="center">
<b>Date Inscription</b>
</TD>
<TD class="txt" align="center">
<b>Date MAJ</b>
</TD>
<TD class="txt" align="center">
<b>N°Maison Mère</b>
</TD>
<TD class="txt" align="center">
<b>remarque</b>
</TD>
</TR>
<?
//récuperaton des infos sur les entreprises
while($entreprise_classer=mysql_fetch_array($reponse))
{
?>
<TR>
<TD class="txt" align="center">
<? echo $entreprise_classer['IdEntreprise']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['NumSIREN']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['NumSIRET']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['NomEntreprise']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['AdresseGeo']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['CP']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['VilleGeo']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['AdressePost']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['Cedex']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['VillePost']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['NumTelephone']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['Fax']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['Email']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['SiteWeb']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['Effectif']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['CodeAPE']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['DateInscription']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['DateMAJ']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['NumMaisonM']; ?>
</TD>
<TD class="txt" align="center">
<? echo $entreprise_classer['remarque']; ?>
</TD>
</TR>
<?
}
}?></TABLE>
<?
mysql_close();
?>
</body>
</html>
<?php
$sql = 'SELECT * FROM `entreprise` ';
$sql .= 'WHERE `NumSIREN` = "' . mysql_real_escape_string($_POST['NumSIREN'] . '" ';
$sql .= 'OR `NomEntreprise` = "' . mysql_real_escape_string($_POST['NomEntreprise'] . '"';
$reponse = mysql_query($sql) or die('Erreur SQL !<br />Veuillez contacter l\'administreur du service.'.mysql_error());
// Mise en tableau des données.
$entreprise_classer = mysql_fetch_assoc($reponse);
if($entreprise_classer) {
// L'affichage de tes données
}
else {
// Elle existe pas.
}
?>
<?php
$sql = 'SELECT * FROM `entreprise` ';
$sql .= 'WHERE `NumSIREN` = "' . mysql_real_escape_string($_POST['NumSIREN']) . '" ';
$sql .= 'OR `NomEntreprise` = "' . mysql_real_escape_string($_POST['NomEntreprise']) . '"';
$reponse = mysql_query($sql) or die('Erreur SQL !<br />Veuillez contacter l\'administreur du service.'.mysql_error());
// Mise en tableau des données.
$entreprise_classer = mysql_fetch_assoc($reponse);
if($entreprise_classer) {
// L'affichage de tes données
}
else {
// Elle existe pas.
}
?>