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

(singke) #1

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


$Query = "INSERT INTO store VALUES (0, 'Martinez')";
$Result = msql_query($Query, $Link);


msql_free_result($Result);


msql_close($Link);
?>


integer msql_list_dbs(integer link)


The msql_list_dbs function returns a result identifier as if the database were queried
with msql_query. Any of the functions for fetching rows or fields may be used to get the
names of the databases. The link argument is optional. If left out, the last-opened
connection will be used.


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


$Result = msql_list_dbs($Link);
while($row_array = msql_fetch_row($Result))
{
print($row_array[0]. "
\n");
}


msql_close($Link);
?>


integer msql_list_fields(string database, string tablename,
integer link)


The msql_list_fields function returns a result identifier as if the database were
queried with msql_query. Any of the functions for fetching rows or fields may be used to
get the names of the fields. The link argument is optional. If left out, the last-opened
connection will be used.


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


$Result = msql_list_fields("store", "item",$Link);
while($row_array = msql_fetch_row($Result))
{

Free download pdf