SQL Query Correct? - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Site and Server Administration » SQL Query Correct?


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-12-2006   #1 (permalink)
gabriel
Member
 
Join Date: Jul 2006
Age: 38
Posts: 30
Default SQL Query Correct?

Hi Everybody,

First let me say I am very grateful to have found a place where I can get some help learning PHP! I am learning by myself out of books, and have no experience with other languages other than html and css.

I am creating a script (given in a book) that is supposed to take a username and password from a form, and check that it is in a mysql database, and then, if a match is found, echo a message.

I can't get it to work, and I think the place where it is failing is the sql query itself, so I am hoping that someone may see something from with the syntax. The query I am using is

$sql= "SELECT * FROM $table_name WHERE username = '$_POST[username]' AND password = password('$_POST[password]')";


I am using PHP 5.1.2, and mysql 4.1.15. Thanks so much for checking this out!

Best,
mysql remote connection

Hello. I hope somebody can help me solve this one.

I need to connect remotely to a mysql server using:

mysql -u remoteuser -h x.x.x.x -p

Where x.x.x.x is the ip address of the remote mysql server.

On the remote server, I already issued the following grant commands:

grant all privileges on dbname.* to remoteuser@'localhost' identified by 'passwd'

grant all privileges on dbname.* to remoteuser@'%' identified by 'passwd'

The above two commands should allow a connection from anywhere.

Also, port 3306 is not blocked in the firewall.

But when I run the command below from a remote machine:

mysql -u remoteuser -h x.x.x.x -p

I get the error:
ERROR 2003: Can't connect to MySQL server on 'x.x.x.x' (113)

What have I missed?

Server version: 4.1.19
Gabriel
gabriel is offline   Reply With Quote


Old 07-21-2006   #2 (permalink)
alex
Senior Member
 
alex's Avatar
 
Join Date: Jul 2006
Age: 30
Posts: 124
Default Re: SQL Query Correct?

The problem isn't php, it's a permissions issue with mysql. I would sugget locking things down to the specific ip.

grant all privileges on dbname.* to remoteuser@'xxx.xxx.xxx.xxxx' identified by 'passwd'

Also, I wouldn't use grant all, only the permissions that you need.

Let me know if that helps.
alex is offline   Reply With Quote

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


footer left
All times are GMT. The time now is 01:34 AM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

Free Ringtone | Bad Credit Mortgages | Cell Phones | Dirty Dozen Brass Band | Loans

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49