script réalisé avec :
PHP : 5
MySQL: 5.0.27

Bonjour pour mon progiciels j'ai besoin à un moment de réordonner les numéros de lot voici mon script il marche :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<?php
$select = "SELECT * from Produits, Pays, Types WHERE Produits.checked ='VPN' and Pays.code_p = Produits.pays and Types.code_t = Produits.type ORDER BY pays,type,lot,yvert ASC";
$query = mysql_query($select)or die('Erreur SQL !'.$select.'<br>'.mysql_error());
$numlot = 1;
while($row = mysql_fetch_assoc($query))
	{
		$update = "UPDATE Produits set lot ='".$numlot."' WHERE id_p ='".$row['id_p']."'";
		$queryUPDATE = mysql_query($update)or die('Erreur SQL !'.$update.'<br>'.mysql_error());
		$numlot = $numlot+1;
	}
echo 'Mise à jour des lots effectués';
?>
Bon il y aurai t'il un moyen d'optimisé mon script car cette action peux avoir lieu sur 10000 lots en bouclage de catalogue.

Merci
Antoine