JSP Hosting

HostingServicesSupportOrderAbout UsSoftwareHome

Even experts read the manuals. Our tech support staff has most of the books that are out on a wide variety of web topics. Here are some of their top picks. We think you'll find them useful and informative as well.

Accessing MySQL from PHP

The PHP scripting language offers complete support for MySQL databases in a high-level language that can be included directly in your HTML pages. To connect, use the mysql_connect method as follows:

$link = mysql_connect ("hostname", "username", "password") { or die ("Could not connect"); }
print ("Connected successfully");
mysql_close ($link);

Once connected, a query can be performed as follows:

$result = mysql_query("select * from mytable");

Finally, there are several functions for selecting specific fields from a set of results, including:

mysql_fetch_field(int result, int [field_offset] );
mysql_fetch_row(int result);
mysql_num_rows(int result);

For more detailed information about using MySQL in PHP pages, visit the PHP web site.


Note: MMA technical support staff cannot provide troubleshooting of problems with third-party CGI scripts including but not limited to: Perl scripts, C/C++ binaries, PHP or web/database integration unless these services are specifically contracted. For these services, please see our Quote Request Form.

Copyright © 1995-2012
Motivational Marketing Associates, LLC
All Rights Reserved.