Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mysqli_field_count(3) [php man page]

MYSQLI_FIELD_COUNT(3)							 1						     MYSQLI_FIELD_COUNT(3)

mysqli::$field_count - Returns the number of columns for the most recent query

       Object oriented style

SYNOPSIS
int$mysqli->field_count () DESCRIPTION
Procedural style int mysqli_field_count (mysqli $link) Returns the number of columns for the most recent query on the connection represented by the $link parameter. This function can be useful when using the mysqli_store_result(3) function to determine if the query should have produced a non-empty result set or not without knowing the nature of the query. PARAMETERS
o $ link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3) RETURN VALUES
An integer representing the number of fields in a result set. EXAMPLES
Example #1 $mysqli->field_count example Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "test"); $mysqli->query( "DROP TABLE IF EXISTS friends"); $mysqli->query( "CREATE TABLE friends (id int, name varchar(20))"); $mysqli->query( "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); $mysqli->real_query("SELECT * FROM friends"); if ($mysqli->field_count) { /* this was a select/show or describe query */ $result = $mysqli->store_result(); /* process resultset */ $row = $result->fetch_row(); /* free resultset */ $result->close(); } /* close connection */ $mysqli->close(); ?> Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "test"); mysqli_query($link, "DROP TABLE IF EXISTS friends"); mysqli_query($link, "CREATE TABLE friends (id int, name varchar(20))"); mysqli_query($link, "INSERT INTO friends VALUES (1,'Hartmut'), (2, 'Ulf')"); mysqli_real_query($link, "SELECT * FROM friends"); if (mysqli_field_count($link)) { /* this was a select/show or describe query */ $result = mysqli_store_result($link); /* process resultset */ $row = mysqli_fetch_row($result); /* free resultset */ mysqli_free_result($result); } /* close connection */ mysqli_close($link); ?> PHP Documentation Group MYSQLI_FIELD_COUNT(3)

Check Out this Related Man Page

MYSQLI_COMMIT(3)							 1							  MYSQLI_COMMIT(3)

mysqli::commit - Commits the current transaction

       Object oriented style

SYNOPSIS
bool mysqli::commit ([int $flags], [string $name]) DESCRIPTION
Procedural style bool mysqli_commit (mysqli $link, [int $flags], [string $name]) Commits the current transaction for the database connection. PARAMETERS
o $ link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3) o $flags - A bitmask of MYSQLI_TRANS_COR_* constants. o $name - If provided then COMMIT/*name*/ is executed. RETURN VALUES
Returns TRUE on success or FALSE on failure. CHANGELOG
+--------+-------------------------------------+ |Version | | | | | | | Description | | | | +--------+-------------------------------------+ | 5.5.0 | | | | | | | Added $flags and $name parameters. | | | | +--------+-------------------------------------+ EXAMPLES
Example #1 mysqli::commit example Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $mysqli->query("CREATE TABLE Language LIKE CountryLanguage"); /* set autocommit to off */ $mysqli->autocommit(FALSE); /* Insert some values */ $mysqli->query("INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)"); $mysqli->query("INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)"); /* commit transaction */ if (!$mysqli->commit()) { print("Transaction commit failed "); exit(); } /* drop table */ $mysqli->query("DROP TABLE Language"); /* close connection */ $mysqli->close(); ?> Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "test"); /* check connection */ if (!$link) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } /* set autocommit to off */ mysqli_autocommit($link, FALSE); mysqli_query($link, "CREATE TABLE Language LIKE CountryLanguage"); /* Insert some values */ mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)"); mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)"); /* commit transaction */ if (!mysqli_commit($link)) { print("Transaction commit failed "); exit(); } /* close connection */ mysqli_close($link); ?> SEE ALSO
mysqli_autocommit(3), mysqli_begin_transaction(3), mysqli_rollback(3), mysqli_savepoint(3). PHP Documentation Group MYSQLI_COMMIT(3)
Man Page