query($query, $params = array())

Author Topic: query($query, $params = array())  (Read 948 times)

Offline beingchinmayTopic starter

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 1
  • Posts: 73
  • Karma: 0
  • Gender: Male
  • I am Chinmay
    • Fat Cutter
query($query, $params = array())
« on: 08-11-2016, 07:09:13 »
This is the default way of calling queries if you don’t need to limit the number of results. If the result contains one or more rows, query() returns a result object; otherwise, it returns a Boolean indicating success.

Here is an example that returns results:

Quote
<?php
require_once 'DB.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE, "%s<br />\n");
$dbh = DB::connect("mysql://test@localhost/world");
$result = $dbh->query("SELECT Name FROM City WHERE " .
"CountryCode = 'NOR'");
while ($result->fetchInto($row)) {
print "$row[0]<br />\n";
}


 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1592 Views
Last post 10-10-2011, 03:31:57
by manvbf
1 Replies
3088 Views
Last post 12-16-2011, 06:01:10
by Vinil
8 Replies
3065 Views
Last post 04-30-2012, 03:37:02
by globalseo
11 Replies
5835 Views
Last post 09-13-2017, 00:20:31
by berto
0 Replies
851 Views
Last post 08-11-2016, 07:22:02
by beingchinmay