Last active
December 27, 2015 03:29
-
-
Save ChrisGehm/7259858 to your computer and use it in GitHub Desktop.
primer hueco
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('connect.php'); | |
$primerdisponible = ""; | |
$sql1 = mysql_query("SELECT MIN(Numero) AS Numero | |
FROM historial_inventario_cajas | |
WHERE Numero NOT IN (SELECT Numero | |
FROM inventario_cajas)"); | |
while ($g = mysql_fetch_array($sql1)) | |
{ | |
$primerdisponible = $g['Numero']; | |
} | |
if ($primerdisponible == "") | |
{ | |
$sql2=mysql_query("SELECT MAX(Numero) AS Numero | |
FROM inventario_cajas"); | |
while ($f = mysql_fetch_array($sql2)) | |
{ | |
$primerdisponible = $f['Numero']+1; | |
} | |
} | |
echo 'Primer numero disponible: '.$primerdisponible.''; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment