Re: [PHP-DB] Connecting to MySQL

2011-01-15 Thread Kranthi Krishna
note that you'll have to restart apache after any changes to httpd.conf/php.ini

in your case httpd.conf was changed when u installed PDO

Kranthi.
http://goo.gl/e6t3

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



RE: [PHP-DB] Connecting to MySQL

2011-01-15 Thread Cristiano Di Buduo

Resolved itself, just had to reboot. Works fine now.
Thanks anyway :)


> From: cristiano_di_bu...@hotmail.com
> To: phps...@gmail.com
> Subject: RE: [PHP-DB] Connecting to MySQL
> Date: Fri, 14 Jan 2011 21:58:33 +0100
>
>
> It outputs:
>
> PDO
> PDO support enabled
> PDO drivers mysql, odbc, sqlite
>
>
> 
> > From: phps...@gmail.com
> > Date: Fri, 14 Jan 2011 15:52:55 -0500
> > To: cristiano_di_bu...@hotmail.com
> > CC: php-db@lists.php.net
> > Subject: Re: [PHP-DB] Connecting to MySQL
> >
> > On Fri, Jan 14, 2011 at 2:15 PM, Cristiano Di Buduo
> > wrote:
> > >
> > > I just downloaded both PHP and MySQL, both newest stable versions, both 
> > > are working well, but when i try{} to :
> > >
> > > $dbh = new PDO('mysql:host=localhost;dbname=test', "user", "passwd");
> > >
> > > i catch{} a "could not find driver" error.
> > >
> > > Any help with this?
> > >
> > > I think the proper modules were set up in the php.ini by default.
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> > Check the php.ini or run to see if the PDO is enabled
> >
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Connecting to MySQL

2011-01-14 Thread Bastien Koert
On Fri, Jan 14, 2011 at 2:15 PM, Cristiano Di Buduo
 wrote:
>
> I just downloaded both PHP and MySQL, both newest stable versions, both are 
> working well, but when i try{} to :
>
>     $dbh = new PDO('mysql:host=localhost;dbname=test', "user", "passwd");
>
> i catch{} a "could not find driver" error.
>
> Any help with this?
>
> I think the proper modules were set up in the php.ini by default.
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Check the php.ini or run  to see if the PDO is enabled

-- 

Bastien

Cat, the other other white meat

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



[PHP-DB] Connecting to MySQL

2011-01-14 Thread Cristiano Di Buduo

I just downloaded both PHP and MySQL, both newest stable versions, both are 
working well, but when i try{} to :
 
 $dbh = new PDO('mysql:host=localhost;dbname=test', "user", "passwd");
 
i catch{} a "could not find driver" error.
 
Any help with this?
 
I think the proper modules were set up in the php.ini by default.   
  
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Connecting to mysql from another host

2007-08-03 Thread Goltsios Theodore
Well you it depends on what method you use to access mysql. If for 
instance if you use PDO you could do something like that to  connect and 
query:

 $db_handler  = new PDO('mysql:host='.$dbhost.';dbname='.$db, $dbuser, 
$dbpass);


$query = "SELECT id, fname, lname FROM users WHERE id>'1'";
$st_handler  = $db_handler->prepare($query);
$st_handler->execute();

?>

Have in mind that you must have installed the PDO mysql modules using 
pear for this method to work. There are other methods like this one:

http://www.php-mysql-tutorial.com/connect-to-mysql-using-php.php

Have fun,

Theodoros Goltsios
Kinetix Tele.com Support Center
email: [EMAIL PROTECTED], [EMAIL PROTECTED]
Tel. & Fax: +30 2310556134
WWW: http://www.kinetix.gr/



joefazee wrote:

I want to connect to a database hosted on another server like from
www.sample.com i want to connect to www.example2.com.what did i need to do?

Thanks.
  


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



[PHP-DB] Connecting to mysql from another host

2007-08-02 Thread joefazee

I want to connect to a database hosted on another server like from
www.sample.com i want to connect to www.example2.com.what did i need to do?

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Connecting-to-mysql-from-another-host-tf4210929.html#a11978401
Sent from the Php - Database mailing list archive at Nabble.com.


Re: [PHP-DB] Connecting To Mysql through php/mysqli

2005-02-03 Thread David Robley
On Thu, 3 Feb 2005 13:49, Graeme wrote:

> I like the idea of a mysqli_queasy() function. Maybe it would allow you
> to sumbit SQL statements that don't conform to any standard? ;)
> 
> graeme.
> 
> Bastien Koert wrote:
> 
>> the second error is a misspelling in the mysqli_query command
>>
>> bastien
>>
>>> Call to undefined function mysqli_quesry() in C:\Apache

Or it vomits on your monitor if there is a syntax error?

-- 
David

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



Re: [PHP-DB] Connecting To Mysql through php/mysqli

2005-02-02 Thread graeme
I like the idea of a mysqli_queasy() function. Maybe it would allow you 
to sumbit SQL statements that don't conform to any standard? ;)

graeme.
Bastien Koert wrote:
the second error is a misspelling in the mysqli_query command
bastien
Call to undefined function mysqli_quesry() in C:\Apache 

--
Experience is a good teacher, but she sends in terrific bills.
Minna Antrim
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Connecting To Mysql through php/mysqli

2005-02-02 Thread J. Connolly
Thank you Bastian, I found that the two variables were reversed right 
when your answer came in. The book i got is horrible.

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


RE: [PHP-DB] Connecting To Mysql through php/mysqli

2005-02-02 Thread Bastien Koert
mysqli_select_db progblem is that the arguements are reversed, should be 
$link, $dbname

the second error is a misspelling in the mysqli_query command
bastien
From: "J. Connolly" <[EMAIL PROTECTED]>
To: PHP list 
Subject: [PHP-DB] Connecting To Mysql through php/mysqli
Date: Wed, 02 Feb 2005 10:39:37 -0500
I am getting the gollowing error message:
PHP Warning: mysqli_select_db() expects parameter 1 to be mysqli, string 
given in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 5 PHP 
Fatal error: Call to undefined function mysqli_quesry() in C:\Apache 
Group\Apache2\htdocs\PHP\_debug_tmp.php on line 9

With the following code:
1
2//in order to connect
3$conn = mysqli_connect("localhost","root","67568");
4//inorder to designate database
5mysqli_select_db("php_example", $conn);
6
7//creating a table
8$sql = "CREATE TABLE inventory (id int not null primary key 
auto_increment, item varchar(75))";
9$result = mysqli_query($sql, $conn);
10echo $result;
11?>

I am a total noob and am trying to copy this right out of a book (except 
the mysqli part which i had to struggle through on my own). I am using 
MySql 4.1.8 and PHP5 on Apache 2.0 server. Any help would be great.
Thank you,
jozef

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


[PHP-DB] Connecting To Mysql through php/mysqli

2005-02-02 Thread J. Connolly
I am getting the gollowing error message:
PHP Warning: mysqli_select_db() expects parameter 1 to be mysqli, string 
given in C:\Apache Group\Apache2\htdocs\PHP\_debug_tmp.php on line 5 PHP 
Fatal error: Call to undefined function mysqli_quesry() in C:\Apache 
Group\Apache2\htdocs\PHP\_debug_tmp.php on line 9

With the following code:
1
2//in order to connect
3$conn = mysqli_connect("localhost","root","67568");
4//inorder to designate database
5mysqli_select_db("php_example", $conn);
6
7//creating a table
8$sql = "CREATE TABLE inventory (id int not null primary key 
auto_increment, item varchar(75))";
9$result = mysqli_query($sql, $conn);
10echo $result;
11?>

I am a total noob and am trying to copy this right out of a book (except 
the mysqli part which i had to struggle through on my own). I am using 
MySql 4.1.8 and PHP5 on Apache 2.0 server. Any help would be great.
Thank you,
jozef

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


RE: [PHP-DB] connecting to mySQL - testing server specified does not map to the http://localhost/_MMServerScript/MMHTTPDB.php

2003-06-17 Thread Creative Solutions New Media
PHP is for sure not installed correctly.  I hand a similar problem when I
did the install for the first time.

It was a while agoand I don't remember clearly but I seem to remember
that it had to do with mis-configuring apache for PHP.

Honestly the best solution for all the time it would take is to just
uninstall mySQL and PHP and go at it again following the directions closely.

If you're looking for a handholding process through the installs the book
"Foundation Dreamweaver MX" by Friends of Ed has a great opening on getting
set up with PHP and mySQL.

Tim Winters
Manager, Creative Development
Sampling Technologies Incorporated (STI)
[EMAIL PROTECTED]
[EMAIL PROTECTED]
W: 902 450 5500
C:  902 430 8498

-Original Message-
From: Ildiko Nyari [mailto:[EMAIL PROTECTED]
Sent: June 17, 2003 9:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] connecting to mySQL - testing server specified does not
map to the http://localhost/_MMServerScript/MMHTTPDB.php

Hello,
I have installed the PHP, mySQL and Apache on WIN XP, but:

1. when I want to open in the explorer: http://localhost/test.php  I always
get a download window, and than my Dreamweaver MX opens, and so I can't see
the test.php file I created in the explorer.

2. When I created a php file in Dreamweaver MX, and I want to connect it to
mySQL, I have problems with the connection. It doesn't connect, the error
always something with the:
The testing server specified for this site does not map to the
http://localhost/_MMServerScript/MMHTTPDB.php Verify that the URL prefix
maps to the root of the site.

What is wrong? What and how can I do?
I get crazy.
THANKS,
ildiko



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



Re: [PHP-DB] connecting to mySQL - testing server specified doesnot map to the http://localhost/_MMServerScript/MMHTTPDB.php

2003-06-17 Thread John W. Holmes
Ildiko Nyari wrote:

I have installed the PHP, mySQL and Apache on WIN XP, but:

1. when I want to open in the explorer: http://localhost/test.php  I always get a download window, and than my Dreamweaver MX opens, and so I can't see the test.php file I created in the explorer.
You don't have PHP/Apache installed correctly. Do normal HTML pages come 
upcorrectly?

2. When I created a php file in Dreamweaver MX, and I want to connect it to mySQL, I 
have problems with the connection. It doesn't connect, the error always something with 
the:
The testing server specified for this site does not map to the 
http://localhost/_MMServerScript/MMHTTPDB.php Verify that the URL prefix maps to the 
root of the site.
No idea about that. Sounds DMX specific.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





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


[PHP-DB] connecting to mySQL - testing server specified does not map to the http://localhost/_MMServerScript/MMHTTPDB.php

2003-06-17 Thread Ildiko Nyari
Hello,
I have installed the PHP, mySQL and Apache on WIN XP, but:

1. when I want to open in the explorer: http://localhost/test.php  I always get a 
download window, and than my Dreamweaver MX opens, and so I can't see the test.php 
file I created in the explorer.

2. When I created a php file in Dreamweaver MX, and I want to connect it to mySQL, I 
have problems with the connection. It doesn't connect, the error always something with 
the:
The testing server specified for this site does not map to the 
http://localhost/_MMServerScript/MMHTTPDB.php Verify that the URL prefix maps to the 
root of the site.

What is wrong? What and how can I do?
I get crazy.
THANKS,
ildiko


RE: [PHP-DB] Connecting to Mysql Server

2003-01-29 Thread Neil Lathwood
web man wrote:
> How can I change the default connecting port using php script.

That depends on hwo you connect currently, try this:

http://www.php.net/manual/en/function.mysql-connect.php

Neil

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




[PHP-DB] Connecting to Mysql Server

2003-01-29 Thread web man

Hi,

How can I change the default connecting port using php script.

Thanks



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


Re: [PHP-DB] Connecting to mySQL database

2002-02-16 Thread DL Neil

Hi Alvin,

> I'm new to both PHP and mySQL but have no choice but to "crash-course" on
> both before end of mid of march to complete my University project. I would
> really appreciate alittle help from any kind soul out there.
>
> I have already created a mySQL database and create all the tables *well at
> least all those that i think i need*. Now i am trying to connect to the
> database and test if everything was created properly and make sure i can
> connect.
>
> Can anyone please advise on how i should go abt it?? Thanks a million!!!


Welcome to our happy little (ever-expanding) world!

I suggest a visit to the PHP and MySQL homepages. If you look for the links and 
tutorial pages, you will find
plenty of the latter. There are a number of web articles on 'intro to MySQL and PHP' 
and 'making dynamic web
sites'. These types of tutorials cover all the basics that you're going to need to get 
started.

Later on, another visit may even yield something about inventory systems, perhaps the 
sites offering classes
might have something handy you can pick up and apply.

If you prefer books/the Uni library: "PHP and MySQL Web Development" by Welling and 
Thomson or "MySQL" by DuBois
are good choices - both cover interfacing the two products, but there are numerous 
alternatives that others will
recommend.

Regards,
=dn



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




[PHP-DB] Connecting to mySQL database

2002-02-16 Thread Alvin Ang

Hi ppl,

I'm new to both PHP and mySQL but have no choice but to "crash-course" on
both before end of mid of march to complete my University project. I would
really appreciate alittle help from any kind soul out there.

I have already created a mySQL database and create all the tables *well at
least all those that i think i need*. Now i am trying to connect to the
database and test if everything was created properly and make sure i can
connect.

Can anyone please advise on how i should go abt it?? Thanks a million!!!

Alvin

P.S: My school project is on developing a web-based inventory managament
system. :P


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




Re: [PHP-DB] Connecting to MySQL Database

2001-12-13 Thread Michael Elliott

After using your suggestion, I found an additional SPELLING mistake that was
causing my problem!

Thanks for your help



- Original Message -
From: "Jonathan Hilgeman" <[EMAIL PROTECTED]>
To: "'Michael Elliott'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, December 13, 2001 11:46 AM
Subject: RE: [PHP-DB] Connecting to MySQL Database


> Try moving session_start to the very top of the script (above the require
> statement), and then place the session_register on the line immediately
> below session_start. You should first create the empty session variable
> $admin_user, and THEN assign a value to it. But the most logical thing to
do
> would be to put all the session information at the very top of the script.
>
> - Jonathan
>
> -Original Message-
> From: Michael Elliott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 13, 2001 8:40 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Connecting to MySQL Database
>
>
> Alright here goes.
>
> This is my login function:
>
> function login($username, $password)
> // check username and password with db
> // if yes, return true
> // else return false
>
> {
>  // connect to db
>  $conn = db_connect();
>  if (!$conn)
>   return 0;
>
>  // check if username is unique
>  $result = mysql_query("select * from admin
>   where username='username' and
>   password = password('$password')");
>
>  if (!$result)
>   return 0;
>
>  if (mysql_num_rows($result)>0)
>   return 1;
>  else
>   return 0;
> }
>
> And here is my admin.php page:
>
> 
> // include function files for this application
> require_once("golf_fns.php");
> session_start();
>
> if ($username && $passwd)
> // they have just tried logging in
> {
>  if (login($username, $passwd))
>  {
>   // if they are in the database register the user id
>   $admin_user = $username;
>   session_register("admin_user");
>  }
>  else
>  {
>   // unsuccessful login
>   do_html_header("Problem:");
>   echo "You could not be logged in.
>   You must be logged in to view this page. ";
>   do_html_url("login.php", "Login");
>   do_html_footer();
>   exit;
>  }
> }
>
> do_html_header("Administration");
> if (check_admin_user())
>  display_admin_menu();
> else
>  echo "You are not authorized to enter the administration area.";
>
> do_html_footer();
>
> ?>
>
> I checked my database and as you said, the password has been encrypted.
> Shouldn't MySQL be able to compare it against an encrypted password?
>
> Thanks for your help!
>
>
> "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Can you show us the code that checks the username and password to see if
> > they're correct?
> >
> > Is this a custom admin page that you created?
> >
> > If your page is authenticating against the "mysql" database, then you
> should
> > know that MySQL encrypts the password and stores  the encrypted
password.
> >
> > So if you use the GRANT statement to create a new user that looks like:
> > User: admin
> > Pass: Secrets
> >
> > ...MySQL will store this as:
> > User: admin
> > Pass: Ata91230t!44
> >
> > So if you try to login and your login code looks like:
> > if($PasswordEntered == $DatabasePassword)
> > {
> > ...
> > }
> >
> > So even if $PasswordEntered equals "Secrets", it won't be the same,
> because
> > it won't match the encrypted password.
> >
> > - Jonathan
> >
> > -Original Message-
> > From: Michael Elliott [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, December 13, 2001 5:54 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Connecting to MySQL Database
> >
> >
> > I am trying to create an admin page to administer my database.  I used a
> > file .sql to create my database.  In the file, I included:
> >
> > grant select, insert, update, delete
> > on database.*
> > to admin@localhost identified by 'password';
> >
> > Why can I not log in successfully using admin and password?
> >
> > Thanks
> >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Connecting to MySQL Database

2001-12-13 Thread Jonathan Hilgeman

Try moving session_start to the very top of the script (above the require
statement), and then place the session_register on the line immediately
below session_start. You should first create the empty session variable
$admin_user, and THEN assign a value to it. But the most logical thing to do
would be to put all the session information at the very top of the script.

- Jonathan

-Original Message-
From: Michael Elliott [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 13, 2001 8:40 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Connecting to MySQL Database


Alright here goes.

This is my login function:

function login($username, $password)
// check username and password with db
// if yes, return true
// else return false

{
 // connect to db
 $conn = db_connect();
 if (!$conn)
  return 0;

 // check if username is unique
 $result = mysql_query("select * from admin
  where username='username' and
  password = password('$password')");

 if (!$result)
  return 0;

 if (mysql_num_rows($result)>0)
  return 1;
 else
  return 0;
}

And here is my admin.php page:

";
  do_html_url("login.php", "Login");
  do_html_footer();
  exit;
 }
}

do_html_header("Administration");
if (check_admin_user())
 display_admin_menu();
else
 echo "You are not authorized to enter the administration area.";

do_html_footer();

?>

I checked my database and as you said, the password has been encrypted.
Shouldn't MySQL be able to compare it against an encrypted password?

Thanks for your help!


"Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can you show us the code that checks the username and password to see if
> they're correct?
>
> Is this a custom admin page that you created?
>
> If your page is authenticating against the "mysql" database, then you
should
> know that MySQL encrypts the password and stores  the encrypted password.
>
> So if you use the GRANT statement to create a new user that looks like:
> User: admin
> Pass: Secrets
>
> ...MySQL will store this as:
> User: admin
> Pass: Ata91230t!44
>
> So if you try to login and your login code looks like:
> if($PasswordEntered == $DatabasePassword)
> {
> ...
> }
>
> So even if $PasswordEntered equals "Secrets", it won't be the same,
because
> it won't match the encrypted password.
>
> - Jonathan
>
> -Original Message-
> From: Michael Elliott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 13, 2001 5:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Connecting to MySQL Database
>
>
> I am trying to create an admin page to administer my database.  I used a
> file .sql to create my database.  In the file, I included:
>
> grant select, insert, update, delete
> on database.*
> to admin@localhost identified by 'password';
>
> Why can I not log in successfully using admin and password?
>
> Thanks
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Connecting to MySQL Database

2001-12-13 Thread Michael Elliott

Alright here goes.

This is my login function:

function login($username, $password)
// check username and password with db
// if yes, return true
// else return false

{
 // connect to db
 $conn = db_connect();
 if (!$conn)
  return 0;

 // check if username is unique
 $result = mysql_query("select * from admin
  where username='username' and
  password = password('$password')");

 if (!$result)
  return 0;

 if (mysql_num_rows($result)>0)
  return 1;
 else
  return 0;
}

And here is my admin.php page:

";
  do_html_url("login.php", "Login");
  do_html_footer();
  exit;
 }
}

do_html_header("Administration");
if (check_admin_user())
 display_admin_menu();
else
 echo "You are not authorized to enter the administration area.";

do_html_footer();

?>

I checked my database and as you said, the password has been encrypted.
Shouldn't MySQL be able to compare it against an encrypted password?

Thanks for your help!


"Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Can you show us the code that checks the username and password to see if
> they're correct?
>
> Is this a custom admin page that you created?
>
> If your page is authenticating against the "mysql" database, then you
should
> know that MySQL encrypts the password and stores  the encrypted password.
>
> So if you use the GRANT statement to create a new user that looks like:
> User: admin
> Pass: Secrets
>
> ...MySQL will store this as:
> User: admin
> Pass: Ata91230t!44
>
> So if you try to login and your login code looks like:
> if($PasswordEntered == $DatabasePassword)
> {
> ...
> }
>
> So even if $PasswordEntered equals "Secrets", it won't be the same,
because
> it won't match the encrypted password.
>
> - Jonathan
>
> -Original Message-
> From: Michael Elliott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 13, 2001 5:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Connecting to MySQL Database
>
>
> I am trying to create an admin page to administer my database.  I used a
> file .sql to create my database.  In the file, I included:
>
> grant select, insert, update, delete
> on database.*
> to admin@localhost identified by 'password';
>
> Why can I not log in successfully using admin and password?
>
> Thanks
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Connecting to MySQL Database

2001-12-13 Thread Jonathan Hilgeman

Can you show us the code that checks the username and password to see if
they're correct?

Is this a custom admin page that you created? 

If your page is authenticating against the "mysql" database, then you should
know that MySQL encrypts the password and stores  the encrypted password.

So if you use the GRANT statement to create a new user that looks like:
User: admin
Pass: Secrets

...MySQL will store this as:
User: admin
Pass: Ata91230t!44

So if you try to login and your login code looks like:
if($PasswordEntered == $DatabasePassword)
{
...
}

So even if $PasswordEntered equals "Secrets", it won't be the same, because
it won't match the encrypted password.

- Jonathan

-Original Message-
From: Michael Elliott [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 13, 2001 5:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to MySQL Database


I am trying to create an admin page to administer my database.  I used a
file .sql to create my database.  In the file, I included:

grant select, insert, update, delete
on database.*
to admin@localhost identified by 'password';

Why can I not log in successfully using admin and password?

Thanks




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Connecting to MySQL Database

2001-12-13 Thread Michael Elliott

I am trying to create an admin page to administer my database.  I used a
file .sql to create my database.  In the file, I included:

grant select, insert, update, delete
on database.*
to admin@localhost identified by 'password';

Why can I not log in successfully using admin and password?

Thanks




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Connecting to MySQL

2001-06-22 Thread Andreas D. Landmark

At 22.06.2001 09:42, you wrote:
>How can I connect to our MySQL server remotely. Ordinarily, we upload the 
>same PHP application the same machine that runs MySQL too. So, I just 
>access it using "localhost" in the mysql_connect( ) function, like:
>
> mysql_connect($servername,$dbusername,$dbpassword);
>
> where $servername = "localhost"
>
>
>What if I want to access the MySQL server from my Win test machine that 
>runs Apache?
>

change the servername variable to the hostname of your database server and make
sure that you are allowed to connect (either in mysql.db or mysql.user).

btw. it's always a good idea to use a different topic than a subject just 
discussed..

-- 
Andreas D Landmark / noXtension
Real Time, adj.:
 Here and now, as opposed to fake time, which only occurs there
and then.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Connecting to MySQL

2001-06-22 Thread Jan de Koster

What needs to be done is that you create a new user in the 'user' databese
where you replace 'localhost' with the IP number of the machine you will be
using to log in to your database and then grant the appropriate priviliges.

hope to have been of any help.
jan

Lester June Cabrera wrote:

> How can I connect to our MySQL server remotely. Ordinarily, we upload the
> same PHP application the same machine that runs MySQL too. So, I just
> access it using "localhost" in the mysql_connect( ) function, like:
>
> mysql_connect($servername,$dbusername,$dbpassword);
>
> where $servername = "localhost"
>
> What if I want to access the MySQL server from my Win test machine that
> runs Apache?
>
> Thanks,
> Lester
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Connecting to MySQL

2001-06-22 Thread Lester June Cabrera


How can I connect to our MySQL server remotely. Ordinarily, we upload the 
same PHP application the same machine that runs MySQL too. So, I just 
access it using "localhost" in the mysql_connect( ) function, like:

mysql_connect($servername,$dbusername,$dbpassword);

where $servername = "localhost"


What if I want to access the MySQL server from my Win test machine that 
runs Apache?


Thanks,
Lester


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED] 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Connecting to MySQL

2001-06-22 Thread Dobromir Velev

Hi,
the @localhost is to show the database server you are trying to log on and
it has nothing to do with your problem.
Please check your username and password and if you have the right
permissions.

Dobromir Velev

-Original Message-
From: Keith Whyman <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, June 21, 2001 8:31 PM
Subject: [PHP-DB] Connecting to MySQL


>Can anyone help with this problem !
>user name should just be keith but the @localhost gets added and then I
>can't connect ???
>
>Warning: MySQL Connection Failed: Access denied for user: 'keith@localhost'
>(Using password: YES) in /usr/var/www/www.happy.de/html/cms/test.php on
line
>23
>Problem connecting to DataBase
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Connecting to MySQL

2001-06-22 Thread Keith Whyman

Thanks everyone for the help !
Discovered the problem !

My provider had changed the name of the host, without telling anyone !

ahhh the sort of thing that makes life fun ! :-)

> Sounds like either:
>
> 1) You don't have your correct username/password info in the mySQL/user
> table
> or
> 2) Your server is bound to an IP address or something (a frequent problem
on
> Win machines, but it looks like you're using Linux or something)
>
> The localhost part isn't really the username that is being sent. It simply
> appends the @localhost so you can see where you're connecting to. I would
> check the users table in the mysql database.
>
> - Jonathan
>
> -Original Message-
> From: Keith Whyman [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 21, 2001 7:52 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Connecting to MySQL
>
>
> Can anyone help with this problem !
> user name should just be keith but the @localhost gets added and then I
> can't connect ???
>
> Warning: MySQL Connection Failed: Access denied for user:
'keith@localhost'
> (Using password: YES) in /usr/var/www/www.happy.de/html/cms/test.php on
line
> 23
> Problem connecting to DataBase
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Connecting to MySQL

2001-06-22 Thread Christopher Ostmo

Keith Whyman pressed the little lettered thingies in this order...

> Can anyone help with this problem !
> user name should just be keith but the @localhost gets added and then I
> can't connect ???
> 
> Warning: MySQL Connection Failed: Access denied for user: 'keith@localhost'
> (Using password: YES) in /usr/var/www/www.happy.de/html/cms/test.php on
> line 23 Problem connecting to DataBase
> 

A copy of the code you are trying to use to connect top the DB would 
be helpful.

Basically, "@localhost" gets added to your username whenever you 
haven't specified a host name. Did you use mysql_connect() or 
mysql_pconnect() before attempting to run the query?
mysql_connect("host_name","user","password");
$result = mysql("db_name","query");

Christopher Ostmo
a.k.a. [EMAIL PROTECTED]
AppIdeas.com
Meeting cutting edge dynamic
web site needs

For a good time,
http://www.AppIdeas.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Connecting to MySQL

2001-06-21 Thread Jonathan Hilgeman

Sounds like either:

1) You don't have your correct username/password info in the mySQL/user
table
or
2) Your server is bound to an IP address or something (a frequent problem on
Win machines, but it looks like you're using Linux or something)

The localhost part isn't really the username that is being sent. It simply
appends the @localhost so you can see where you're connecting to. I would
check the users table in the mysql database. 

- Jonathan

-Original Message-
From: Keith Whyman [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 21, 2001 7:52 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Connecting to MySQL


Can anyone help with this problem !
user name should just be keith but the @localhost gets added and then I
can't connect ???

Warning: MySQL Connection Failed: Access denied for user: 'keith@localhost'
(Using password: YES) in /usr/var/www/www.happy.de/html/cms/test.php on line
23
Problem connecting to DataBase


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Connecting to MySQL

2001-06-21 Thread Keith Whyman

Can anyone help with this problem !
user name should just be keith but the @localhost gets added and then I
can't connect ???

Warning: MySQL Connection Failed: Access denied for user: 'keith@localhost'
(Using password: YES) in /usr/var/www/www.happy.de/html/cms/test.php on line
23
Problem connecting to DataBase


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]