The mysql_result function returns the value of the specified field in the specified row.
The field argument may be a number, in which case it is considered a field offset. It
may also be the name of a column, either with the table name or without. It could also be
an alias.
In general, this function is very slow. It's better to use mysql_fetch_row or a similar
function.
<?
//connect to server as freetrade user, no password
$dbLink = mysql_connect("localhost", "freetrade", "");
//select the 'freetrade' database
mysql_select_db("freetrade", $dbLink);
// get everything from customer table
$Query = "SELECT * FROM ".
"user u ".
"WHERE u.Login like 'A%' ";
$dbResult = mysql_query($Query, $dbLink);
// get number of rows
$rows = mysql_num_rows($dbResult);
for($i = 0; $i $rows; $i++)
{
$name = mysql_result($dbResult, $i, "u.Login");
print("$name
\n");
}
?>
boolean mysql_select_db(string database, integer link)
Use mysql_select_db to select the default database. Most of the other examples in this
section use mysql_select_db.
ODBC
Open Database Connectivity (ODBC) has become an industry standard for
communicating with a database. The model is simple. Client software is designed to use
an ODBC API. Vendors write drivers that implement this API on the client side and talk
natively to their database on the server side. This allows application developers to write
one application that can communicate with many different databases simply by changing
the driver, which is an external file.
ODBC uses SQL as its language for communicating with any database, even when the
database isn't relational. Microsoft offers drivers that allow you to query text files and