RE: [PHP] Re: Connecting to a DB using PHP and mysql...

2002-04-02 Thread Rick Emery

The error indicates that johndoe doesn't have permissions to any database.
If he did, it should look like:

mysql> show grants for root@localhost;
+-+
| Grants for root@localhost   |
+-+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+-+

> -Original Message-
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 2:06 PM
> To: Rick Emery
> Subject: Rick...
>
>
> Rick,
> After typing in:
>
> mysql> SHOW GRANTS FOR johndoe@localhost;
>
> I get an ERROR 1064
>
> Regards,
> TR
> ..
>
> - Original Message -
> From: Rick Emery <[EMAIL PROTECTED]>
> To: 'Anthony Ritter' <[EMAIL PROTECTED]>;
> <[EMAIL PROTECTED]>
> Sent: Tuesday, April 02, 2002 12:31 PM
> Subject: RE: [PHP] Re: Connecting to a DB using PHP and mysql...
>
>
> > at the mysql command line, type:
> > mysql> show grants for johndoe@localhost;
> >
> > what does it show?
> ..
> >
> > -Original Message-
> > From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, April 02, 2002 1:08 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Re: Connecting to a DB using PHP and mysql...
> >
> >
> > Craig,
> > I tried the following.
> >
> > I was able to connect to mysql but not to the database "contacts".
> >
> > TR
> > ...
> >
> > 
> > 
> >  > 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"";
> > echo"First Name FACE
> > =\"Arial\" SIZE=\"2\">Last Name > SIZE=\"2\">emailState";
> >
> >   while($row=mysql_fetch_array($mysql_result))
> >{
> > $fname=$row["fname"];
> > $lname=$row["lname"];
> > $email=$row["email"];
> > $state=$row["state"];
> > $ID=$row["ID"];
> > echo " $fname > =\"Arial\" SIZE=\"2\">$lname > SIZE=\"2\">$email > SIZE=\"2\">$state";
> >}
> >  }
> > mysql_close($connection);
> > ?>
> > 
> > 
> > ...
> >
> > 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
> > ---
> > [This E-mail scanned for viruses by IAS, an Archiventure Company]
> >
> >
>
> ---
> [This E-mail scanned for viruses by IAS, an Archiventure Company]
> ---
> [This E-mail scanned for viruses by IAS, an Archiventure Company]
>
>

---
[This E-mail scanned for viruses by IAS, an Archiventure Company]

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




RE: [PHP] Re: Connecting to a DB using PHP and mysql...

2002-04-02 Thread Rick Emery

I assume that instead of johndoe, you used the real user name that you have
in your script


-Original Message-
From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 2:06 PM
To: Rick Emery
Subject: Rick...


Rick,
After typing in:

mysql> SHOW GRANTS FOR johndoe@localhost;

I get an ERROR 1064

Regards,
TR
..

- Original Message -
From: Rick Emery <[EMAIL PROTECTED]>
To: 'Anthony Ritter' <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 12:31 PM
Subject: RE: [PHP] Re: Connecting to a DB using PHP and mysql...


> at the mysql command line, type:
> mysql> show grants for johndoe@localhost;
>
> what does it show?
..
>
> -Original Message-
> From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 1:08 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Connecting to a DB using PHP and mysql...
>
>
> Craig,
> I tried the following.
>
> I was able to connect to mysql but not to the database "contacts".
>
> TR
> ...
>
> 
> 
>  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"";
> echo"First Name =\"Arial\" SIZE=\"2\">Last Name SIZE=\"2\">emailState";
>
>   while($row=mysql_fetch_array($mysql_result))
>{
> $fname=$row["fname"];
> $lname=$row["lname"];
> $email=$row["email"];
> $state=$row["state"];
> $ID=$row["ID"];
> echo " $fname =\"Arial\" SIZE=\"2\">$lname SIZE=\"2\">$email SIZE=\"2\">$state";
>}
>  }
> mysql_close($connection);
> ?>
> 
> 
> ...
>
> 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
> ---
> [This E-mail scanned for viruses by IAS, an Archiventure Company]
>
>

---
[This E-mail scanned for viruses by IAS, an Archiventure Company]

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




RE: [PHP] Re: Connecting to a DB using PHP and mysql...

2002-04-02 Thread Rick Emery

at the mysql command line, type:
mysql> show grants for johndoe@localhost;

what does it show?

-Original Message-
From: Anthony Ritter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 1:08 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Connecting to a DB using PHP and mysql...


Craig,
I tried the following.

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

TR
...



";
echo"First NameLast NameemailState";

  while($row=mysql_fetch_array($mysql_result))
   {
$fname=$row["fname"];
$lname=$row["lname"];
$email=$row["email"];
$state=$row["state"];
$ID=$row["ID"];
echo " $fname$lname$email$state";
   }
 }
mysql_close($connection);
?>


...

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

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