Geen cache-versie.


Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code LNG204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher une fonction PHP

maxdb_stmt_execute

maxdb_stmt::execute

(PECL maxdb >= 1.0)

maxdb_stmt_execute -- maxdb_stmt::executeExecutes a prepared Query

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Description

Procedural style

maxdb_stmt_execute ( resource $stmt ) : bool

Object oriented style

maxdb_stmt::execute ( void ) : bool

The maxdb_stmt_execute() function executes a query that has been previously prepared using the maxdb_prepare() function represented by the stmt resource. When executed any parameter markers which exist will automatically be replaced with the appropiate data.

If the statement is UPDATE, DELETE, or INSERT, the total number of affected rows can be determined by using the maxdb_stmt_affected_rows() function. Likewise, if the query yields a result set the maxdb_fetch() function is used.

Note:

When using maxdb_stmt_execute(), the maxdb_fetch() function must be used to fetch the data prior to preforming any additional queries.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Return Values

Returns TRUE on success or FALSE on failure.

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

Examples

Example #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");

/* Prepare an insert statement */
$query "INSERT INTO temp.mycity (zip, name, state) VALUES (?,?,?)";
$stmt $maxdb->prepare($query);

$stmt->bind_param("sss"$val1$val2$val3);

$val1 '11111';
$val2 'Georgetown';
$val3 'NY';

/* Execute the statement */
$stmt->execute();

$val1 '22222';
$val2 'Hubbatown';
$val3 'CA';

/* Execute the statement */
$stmt->execute();

/* close statement */
$stmt->close();

/* retrieve all rows from myCity */
$query "SELECT zip, name, state FROM temp.mycity";
if (
$result $maxdb->query($query)) {
   while (
$row $result->fetch_row()) {
       
printf("%s (%s,%s)\n"$row[0], $row[1], $row[2]);
   }
   
/* free result set */
   
$result->close();
}

/* remove table */
$maxdb->query("DROP TABLE temp.mycity");

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

Example #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");

/* Prepare an insert statement */
$query "INSERT INTO temp.mycity (zip, name, state) VALUES (?,?,?)";
$stmt maxdb_prepare($link$query);

maxdb_stmt_bind_param($stmt"sss"$val1$val2$val3);

$val1 '11111';
$val2 'Georgetown';
$val3 'NY';

/* Execute the statement */
maxdb_stmt_execute($stmt);

$val1 '22222';
$val2 'Hubbatown';
$val3 'CA';

/* Execute the statement */
maxdb_stmt_execute($stmt);

/* close statement */
maxdb_stmt_close($stmt);

/* retrieve all rows from myCity */
$query "SELECT zip, name, state FROM temp.mycity";
if (
$result maxdb_query($link$query)) {
   while (
$row maxdb_fetch_row($result)) {
       
printf("%s (%s,%s)\n"$row[0], $row[1], $row[2]);
   }
   
/* free result set */
   
maxdb_free_result($result);
}

/* remove table */
maxdb_query($link"DROP TABLE temp.mycity");

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

The above example will output something similar to:

11111 (Georgetown,NY)
22222 (Hubbatown,CA)

Eerste pagina van Manuel PHP  Inhoudsopgave Haut

See Also

Zoek een PHP-functie

Vertaling niet beschikbaar

De PHP-handleiding is nog niet in het Nederlands vertaald, dus het scherm is in het Engels. Als u wilt, kunt u het ook in het Frans of in het Duits raadplegen.

Als je de moed voelt, kun je je vertaling aanbieden ;-)

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 30/01/2003 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/php-rf-maxdb-stmt-execute.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : http://php.net

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut