par
coqenpatte » 08 nov. 2013, 20:05
Bonjour,
j aimerais generer un un tableau dans lequel j ai d un coté un numero et en face son code a barre.
Voila ce que j ai fait (attention ca pique un peu les yeux).
//connection au serveur:
$cnx = mysql_connect("", "", "") ;
//sélection de la base de données:
$db = mysql_select_db( "" ) ;
$type=$_POST['type'];
$ligne=0;
//requête SQL:
//$sql = 'SELECT * FROM imports WHERE no_commande = "'.$_POST['no_commande'].'"';
$sql = "SELECT numero_verre FROM reprise";
$requete = mysql_query( $sql, $cnx );
$result = mysql_fetch_array( $requete );
include 'pi_barcode.php';
/**
* Génération du code barre
* @param $numero
* @param $code
* @return string
*/
function genImg($numero, $code) {
$bc = new pi_barcode();
$bc->setCode($code);
$bc->setType('C128');
$bc->setSize(30, 250, 30);
$bc->setText('AUTO');
$bc->hideCodeType();
$bc->setColors('#123456', '#F9F9F9');
$bc->setFiletype('PNG');
$bc->writeBarcodeFile('barcode' . $numero . '.png');
return '<img src="barcode' . $numero . '.png" />';
}
foreach ($result as $index => $value) {
$nb = preg_match('/^verre(\d)$/', $index, $matches);
if ($nb > 0);
}
echo '<table border="0" cellpadding="3">
<tr>
<td></td>
<td><strong>Numero verre</strong></td>
<td><strong>Refait ?</strong></td>
<td>code</td>
</tr>';
while($data = mysql_fetch_array($requete)) {
echo "<tr>
<td align=\"right\">".(++$ligne)."</td>
<td>". $data['numero_verre'] ."</td>
<td>". $data['valide'] ."</td>
<td>" . genImg($matches[1], $value) . "</td>
</tr>";}
Si quelqu un peu me donner un coup de pouce.
merci
Bonjour,
j aimerais generer un un tableau dans lequel j ai d un coté un numero et en face son code a barre.
Voila ce que j ai fait (attention ca pique un peu les yeux).
[php]
//connection au serveur:
$cnx = mysql_connect("", "", "") ;
//sélection de la base de données:
$db = mysql_select_db( "" ) ;
$type=$_POST['type'];
$ligne=0;
//requête SQL:
//$sql = 'SELECT * FROM imports WHERE no_commande = "'.$_POST['no_commande'].'"';
$sql = "SELECT numero_verre FROM reprise";
$requete = mysql_query( $sql, $cnx );
$result = mysql_fetch_array( $requete );
include 'pi_barcode.php';
/**
* Génération du code barre
* @param $numero
* @param $code
* @return string
*/
function genImg($numero, $code) {
$bc = new pi_barcode();
$bc->setCode($code);
$bc->setType('C128');
$bc->setSize(30, 250, 30);
$bc->setText('AUTO');
$bc->hideCodeType();
$bc->setColors('#123456', '#F9F9F9');
$bc->setFiletype('PNG');
$bc->writeBarcodeFile('barcode' . $numero . '.png');
return '<img src="barcode' . $numero . '.png" />';
}
foreach ($result as $index => $value) {
$nb = preg_match('/^verre(\d)$/', $index, $matches);
if ($nb > 0);
}
echo '<table border="0" cellpadding="3">
<tr>
<td></td>
<td><strong>Numero verre</strong></td>
<td><strong>Refait ?</strong></td>
<td>code</td>
</tr>';
while($data = mysql_fetch_array($requete)) {
echo "<tr>
<td align=\"right\">".(++$ligne)."</td>
<td>". $data['numero_verre'] ."</td>
<td>". $data['valide'] ."</td>
<td>" . genImg($matches[1], $value) . "</td>
</tr>";}
[/php]
Si quelqu un peu me donner un coup de pouce.
merci