Craig,
I tried the following.

I was able to connect to mysql but not to the database "contacts".

TR
.......................................................

<HTML>
<BODY>
<?
define("DATABASE_HOST", "localhost");
define("DATABASE_USER", "johndoe");
define("DATABASE_PASSWORD", "abc");
define("DATABASE_NAME", "contacts");

$connection=mysql_connect(DATABASE_HOST,DATABASE_USER,DATABASE_PASSWORD);
if(!$connection)
 {
  echo "Couldn't connect.";
  exit;
 }
$db=mysql_select_db(DATABASE_NAME,$connection);
if(!$db)
 {
  echo "Couldn't connect to the database.";
  exit;
 }
$sql="SELECT * FROM leads";
$mysql_result=mysql_query($sql, $connection);
$num_rows=mysql_num_rows($mysql_result);

if($num_rows==0)
 {
  echo "There is no information";
 }
else
 {
echo"<TABLE ALIGN=\"Center\" BORDER=\"1\">";
echo"<TR><TH><FONT FACE =\"Arial\" SIZE=\"2\">First Name</TH><TH><FONT FACE
=\"Arial\" SIZE=\"2\">Last Name</TH><TH><FONT FACE =\"Arial\"
SIZE=\"2\">email</TH><TH><FONT FACE =\"Arial\" SIZE=\"2\">State</TH>";

  while($row=mysql_fetch_array($mysql_result))
   {
    $fname=$row["fname"];
    $lname=$row["lname"];
    $email=$row["email"];
    $state=$row["state"];
    $ID=$row["ID"];
echo " <TR><TH><FONT FACE =\"Arial\" SIZE=\"2\">$fname</TH><TH><FONT FACE
=\"Arial\" SIZE=\"2\">$lname</TH><TH><FONT FACE =\"Arial\"
SIZE=\"2\">$email</TH><TH><FONT FACE =\"Arial\"
SIZE=\"2\">$state</TH></TR>";
   }
 }
mysql_close($connection);
?>
</BODY>
</HTML>
...........................................

Craig Donnelly wrote in message:
Try this for your connection:
............................................
<?
>
> // Database constants
> define("DATABASE_HOST", "localhost");
> define("DATABASE_USER", "root");
> define("DATABASE_PASSWORD", "*YOUR_PASS*");
> define("DATABASE_NAME", "*YOUR_DB_NAME*");
>
> // Establish connection
> $dbLink = mysql_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD);
> if(!$dbLink) {
>         print "Unable to connect to the database, please contact Sysadmin
> asap.";
> } else {
>    $dbUse = mysql_select_db(DATABASE_NAME, $dbLink);
> }
>
> ?>
>
> --------------------------------------------------------------------------
--
> Hope it helps ya,
>
> Craig




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to