PHP Doku:: Returns the number of warnings from the last query for the given link - function.maxdb-warning-count.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenMaxDBMaxDB Funktionenmaxdb_warning_count -- maxdb->warning_count

Ein Service von Reinhard Neidl - Webprogrammierung.

MaxDB Funktionen

<<maxdb_use_result -- maxdb::use_result

MongoDB Native Driver>>

maxdb_warning_count

maxdb->warning_count

(PECL maxdb >= 1.0)

maxdb_warning_count -- maxdb->warning_countReturns the number of warnings from the last query for the given link

Beschreibung

Prozeduraler Stil

int maxdb_warning_count ( resource $link )

Objektorientierter Stil

int $warning_count;

maxdb_warning_count() returns the number of warnings from the last query in the connection represented by the link parameter.

Rückgabewerte

Number of warnings or zero if there are no warnings.

Beispiele

Beispiel #1 Object oriented style

<?php
$maxdb 
= new maxdb("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");

/* a remarkable city in Wales */
$query "INSERT INTO temp.mycity (zip, name) VALUES('11111',
       'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')"
;

$maxdb->query($query);

printf ("Number of warning: %d\n"$maxdb->warning_count);

/* close connection */
$maxdb->close();
?>

Beispiel #2 Procedural style

<?php
$link 
maxdb_connect("localhost""MONA""RED""DEMODB");

/* check connection */
if (maxdb_connect_errno()) {
   
printf("Connect failed: %s\n"maxdb_connect_error());
   exit();
}

maxdb_query($link"CREATE TABLE temp.mycity LIKE hotel.city");

/* a remarkable long city name in Wales */
$query "INSERT INTO temp.mycity (zip, name) VALUES('11111',
       'Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch')"
;

maxdb_query($link$query);

printf ("Number of warning: %d\n"maxdb_warning_count($link));

/* close connection */
maxdb_close($link);
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Warning: maxdb_query(): -8004 POS(62) Constant must be compatible with column type and length <...>
Number of warning: 0

Siehe auch

  • maxdb_errno() - Returns the error code for the most recent function call
  • maxdb_error() - Returns a string description of the last error
  • maxdb_sqlstate() - Returns the SQLSTATE error from previous MaxDB operation


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)