Oracle 5.0 Reference Manual page 2262

Table of Contents

Advertisement

$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('my_database') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM my_table';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?>
20.7.2.5. MySQL Functions
Copyright 1997-2012 the PHP Documentation Group. [2230]
20.7.2.5.1.
mysql_affected_rows
Copyright 1997-2012 the PHP Documentation Group. [2230]
mysql_affected_rows
Get number of affected rows in previous MySQL operation
Description
int mysql_affected_rows(
resource link_identifier
=
Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query
associated with link_identifier.
Original MySQL API (Mysql)
Note
Most MySQL functions accept
parameter. If it is not provided, last opened connection is used. If it doesn't exist,
connection is tried to establish with default parameters defined in php.ini. If it
is not successful, functions return
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the
future. Instead, the
also
MySQL: choosing an API
Alternatives to this function include:
mysqli_affected_rows
PDOStatement::rowCount
=NULL);
link_identifier
.
FALSE
MySQLi
or
PDO_MySQL
guide and
related FAQ
2242
as the last optional
extension should be used. See
for more information.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents