PHP Velho Oeste 2024

sqlite_has_more

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)

sqlite_has_moreSonuç kümesinde başka satır kaldı mı diye bakar

Açıklama

sqlite_has_more ( resource $sonuç ) : bool

Sonuç kümesinde başka satır kaldı mı diye bakar.

Değiştirgeler

sonuç

SQLite sonuç özkaynağı.

Dönen Değerler

Başka satır varsa TRUE yoksa FALSE döner.

Ayrıca Bakınız

  • sqlite_num_rows() - Tamponlu bir sonuç kümesindeki satır sayısını döndürür
  • sqlite_changes() - En son SQL deyiminin değiştirdiği satır sayısını döndürür

add a note add a note

User Contributed Notes 2 notes

up
-1
dragosmocrii at gmail dot com
16 years ago
I use this function to check if an element exists in the database.

<?php
$cat
=$_REQUEST['cat'];
$db=sqlite_open('./sqlite_database.db',0666,$err) or die();
$query='select * from catsub where cat=\''.$cat.'\'';
$result=sqlite_has_more(sqlite_query($db,$query));
if(
$result===true ) echo 'Exists'; else echo 'Doesnt Exist';
sqlite_close($db);
?>
up
-2
dcchut at gmail dot com
15 years ago
dragosmocrii at gmail dot com:

It is slightly more efficient to use the COUNT function. (And when I say slightly I mean whisker small slightly.)

<?php
// $db is a SQLite database connection

if (sqlite_single_query($db, 'SELECT COUNT(*) FROM records WHERE amount_owing > 500')) {
   
// There are records where the amount owing exceeds $500, do some action.
} else {
   
// No money for you!
}

?>
To Top