Précédent   Forum du club des développeurs et IT Pro > Bases de données > Autres SGBD > SQLite
SQLite Forum d'entraide SQLite
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 25/02/2013, 12h28   #1
Toulousaing
Membre du Club
 
Homme
Programmeur fou
Inscription : octobre 2010
Messages : 123
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France, Haute Garonne (Midi Pyrénées)

Informations professionnelles :
Activité : Programmeur fou

Informations forums :
Inscription : octobre 2010
Messages : 123
Points : 62
Points : 62
Par défaut numRows : méthode inconnue

Hello,

la doc dit http://www.php.net/manual/fr/functio...e-num-rows.php

Code :
1
2
3
4
5
6
7
<?php
$db = new SQLiteDatabase('mysqlitedb');
$result = $db->query("SELECT * FROM mytable WHERE name='John Doe'");
$rows = $result->numRows();
 
echo "Nombre de lignes : $rows";
?>
et mon PC répond :
Code :
1
2
3
4
( ! ) Fatal error: Call TO undefined method SQLite3Result::numRows() IN C:\wamp\www\PCAWEB\sqlite3\sqlite-dump.php ON line 12
Call Stack
#	Time	Memory	Function	Location
1	0.0006	376784	{main}( )	..\sqlite-dump.php:0
Mon source est :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
 
$dbname='base';
$mytable ="tablename";
 
IF(!class_exists('SQLite3'))
  die("SQLite 3 NOT supported.");
 
$base=new SQLite3($dbname, 0666); 
 
$result = $base->query("select * from tablename");
$size = $result->numRows();
echo "$size records in database<br><br>\n";
 
$query = "SELECT post_title, post_content, post_author, post_date, guid FROM $mytable";
$results = $base->query($query);
 
echo "<table><tbody>\n";
 
echo "<tr>\n";
echo "<td width='20%'>Title</td>";
echo "<td width='10%'>Author</td>";
echo "<td >Date</td>";
echo "<td width='50%'>Content</td>";
echo "</tr>\n";
 
while($arr = $results->fetchArray())
{
  IF(count($arr) == 0) break;
 
  echo "<tr>\n";  
 
  $title = $arr['post_title'];
  $content = $arr['post_content']; 
  $user = $arr['post_author'];
  $date = $arr['post_date'];
  $url = $arr['guid'];
 
  echo "<td><a href='$url'>$title</a></td>\n";
  echo "<td>#$user</td>";
  echo "<td>$date</td>\n";
  echo "<td>$content</td>\n";
  echo "</tr>\n";  
} 
echo "</tbody></table>\n";
 
echo "<br>No more data...";  
echo "<hr>";
echo "<i>SQLite Tutorial - <a href='http://www.scriptol.com'>Scriptol.com</a></i>";
 
$base->close();
exit;
?>
Pourquoi, svp ?
Merci bcp.

EDIT : Erreur de doc, cette méthode n'existe pas.
https://bugs.php.net/bug.php?id=49303
__________________
Gestion d'erreurs et scripts Windows : http://www.scripting-errors.com/
Toulousaing est déconnecté   Envoyer un message privé Réponse avec citation 10
Réponse Cette discussion est résolue.
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 02h54.


 
 
 
 
Partenaires

Hébergement Web