Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

The msql_num_rows function returns the number of rows in the result set.


<?
$Link = msql_connect("msql.clearink.com");
msql_select_db("store", $Link);


$Query = "SELECT * FROM item i, SKU s ";
$Query .= "WHERE i.SKU = s.ID ";
$Result = msql_query($Query, $Link);


print(msql_num_rows($Result));


msql_close($Link);
?>


integer msql_pconnect(string host)


The msql_pconnect function is identical to the msql_connect function except that the
connection will not be closed when the script ends. This has meaning only when PHP is
compiled as an Apache module. These are called persistent links because they live as
long as the server process.


<?
$Link = msql_pconnect("localhost");
?>


integer msql_query(string query, integer link)


Use msql_query to execute a query. The database used will be the one specified in a call
to the msql_select_db function. The link argument is optional. The last connection
made will be used if it is left out.


msql_regcase


This is an alias to sql_regcase, described in Chapter 9, "Data Functions."


string msql_result(integer result, integer row, string field)


The msql_result function returns a single field value for the given row. The field
argument can be interpreted in two ways. If it is a number, it will be used as a field offset,
starting with zero. Otherwise, it will be considered to be a column name.


The msql_result function is relatively slow. Its use should be avoided in favor of faster
functions such as msql_fetch_array.

Free download pdf