English 中文(简体)
等同我sql_num_rows
原标题:SQLite3 equivalent to mysql_num_rows
  • 时间:2011-06-27 13:12:57
  •  标签:
  • php
  • sqlite

What s the equivalent in SQLite3 to mysql_num_rows? I know SQLite had a similar function call. What I m doing in PHP is doing a for while fetching an array from the query and counting a variable but I don t like it very much.

最佳回答

You have a changes method that will offer the num rows/affected rows functionality for update/delete methods. For select type queries, you can count the result set or effectively make a second request that will count the result of your previous query (will cost more time to your application). For a "select users where firstname = john " this should look something like this:

缩略语

But it will cost you an extra query and i m pretty sure that counting the returned result set will be more efficient.

问题回答

COUNT?





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签