Hello,
la doc dit http://www.php.net/manual/fr/functio...e-num-rows.php
et mon PC répond :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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"; ?>
Mon source est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Pourquoi, svp ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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; ?>
Merci bcp.
EDIT : Erreur de doc, cette méthode n'existe pas.
https://bugs.php.net/bug.php?id=49303
Partager