How do i do the right to use "NOT IN" in PHP MYSQL -


how can fix problem, because want find id lost , bring me use id lost, did code doesn't work because returns nothing.

php

$query = 'select (folio+1) detalles_devoluciones (folio+1) not in (select folio detalles_devoluciones) limit 1;'; $resultado = mysql_query($query) or die (mysql_error()); $total = mysql_num_rows($resultado);          while ($c = mysql_fetch_array($resultado)){                        $folio = $c['folio'];                    echo $folio;              } 

i test this:

print_r($folio); 

and nothing too

update:

html

<label for="folio">folio:</label>       <input type="text" value="<?=$c["folio"]?>" name="folio"  disabled/>         <input type="hidden" value="<?=$c["folio"]?>" name="folio"  /> 

or

<label for="folio">folio:</label>       <input type="text" value="<?=$folio?>" name="folio"  disabled/>         <input type="hidden" value="<?=$folio?>" name="folio"  /> 

what trying do? why looking folio+1?

the syntax of sql-statement looks correct me, have tried send directly database via phpmyadmin or console?

btw should not use mysql_* extension deprecated. better use mysqli_* or pdos functions handle database-operations.http://php.net/manual/de/mysqlinfo.api.choosing.php

edit: fetch column use alias selected column.

select (folio+1) folio from... 

so can access on index 'folio' after fetching result


Comments