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

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

Offline beingchinmayTopic starter

  • Trade Count: (0)
  • Jr. Member
  • **
  • Thank You 0
  • Posts: 56
  • 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
1376 Views
Last post 10-10-2011, 03:31:57
by manvbf
1 Replies
2766 Views
Last post 12-16-2011, 06:01:10
by Vinil
8 Replies
2339 Views
Last post 04-30-2012, 03:37:02
by globalseo
8 Replies
2552 Views
Last post 12-01-2016, 22:52:40
by 9infotech
0 Replies
457 Views
Last post 08-11-2016, 07:22:02
by beingchinmay