[Techtalk] at wit's end with PHP to MySQL
Glenda R. Snodgrass
grs at theneteffect.com
Wed Jan 30 21:36:08 EST 2002
Try a sequence like this:
mysql_connect("localhost","username","password")
or die("Unable to connect to SQL server");
mysql_select_db("database") or die("Unable to select database");
$result = mysql_query("query");
with some debugging:
if (!$result) {
echo "Oops! ";
echo mysql_errno().": ".mysql_error()."<BR>";
} else {
do something else;
}
You can also use the php_info command:
<? {phpinfo();} ?>
to list all the PHP settings, and maybe you'll find something off there
(like not having the mysql module installed)
--
Glenda R. Snodgrass
Before you begin, consider ... The Net Effect
http://www.theneteffect.com
(251) 433-0196
More information about the Techtalk
mailing list