Re: mysql_connect noob question
| From: | Glob Design Info | Date: | Sat, 20 Apr 2013 12:37:35 +0000 |
| Subject: | Re: mysql_connect noob question | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320906@lists.php.net to get a copy of this message | ||
Thanks for that good suggestion.
I tried that and as expected, the passed variables are coming through exactly as expected:
array(3) {
["user"]=>
string(3) "joe"
["password"]=>
string(11) "complacency"
["login"]=>
string(5) "Login"
}
The bottom one seems to be the submit button's tag.
I'm at a loss too. It should work. Replacing all 3 script variables with hard-coded values for the login works fine - so I know the host string is fine.
Very weird!
On 4/20/13 1:36 AM, tamouse mailing lists wrote:
No, that's for writing safe html output. If the user or password contains special chars, sending them through htmlspecialchars would turn them into html entities. i doubt you want that. I'm at a loss here. The only thing Ican think of is to try something like this at the top of the script: <?php error_reporting(-1); ini_set('display_errors',1); ini_set('display_startup_errors',1); header("Content-type: text/plain"); var_dump($_POST); exit; ?> and see precisely what is being passed in from your form. On Apr 19, 2013 10:50 PM, "Glob Design Info" <info@globdesign.com> wrote:No, no spaces. I am wondering if I need to use htmlspecialchars() On Apr 19, 2013, at 7:17 PM, Jim Giner <jim.giner@albanyhandball.com> wrote:On 4/19/2013 9:33 PM, Glob Design Info wrote:serverThey aren't on the same server. The DB is on xeround.com, the webforis localhost. The host value is set and working. If I hard-code the user and password values in the mysql_connect() call and leave the host value as is, it connects fine. Only passing the user and password from the form cause it to fail. On 4/19/13 5:47 PM, David Robley wrote:Glob Design Info wrote:Sorry. The error displayed is: *Warning*: mysql_connect() [function.mysql-connect <http://localhost/wservices/function.mysql-connect>]: Access deniedinuser '<user>'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES)info@globdesign.com>*/Library/WebServer/Documents/wservices/connect.php* on line *29* (But with the real user name, not just '<user>') Thanks, On 4/19/13 3:28 PM, tamouse mailing lists wrote:On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info <andwrote:I know this has probably been answered already. When I pass a user name and password from a form to my PHP script'localhost'.First guess is that you don't have privileges for '<user>'@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges for '<user>'. And, what are you using for the $host value? If the script and mysql are on the same server, it shouldn't need to be anything other thanthen pass those to mysql_connect it doesn't connect. When I paste those exact same values into mysql_connect as string literals it works. Can anyone tell me why this happens? I know the strings are identical to the literals I try in a test but they don't work when submitted via form. $form_user = $_POST[ 'user' ]; $form_pass = $_POST[ 'password' ]; # Connect to remote DB $LINK = mysql_connect( $host, $form_user, $form_pass );Please show the error you are getting from the mysql_connectAnd yes, my $host param is correct. Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpDo your user or password contain spaces, thereby requiring quotes inyour call?-- 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