Re: mysql_connect error

From: Date: Mon, 25 Aug 2003 04:12:43 +0000
Subject: Re: mysql_connect error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160632@lists.php.net to get a copy of this message
This is working for me. --------------------------- define('db_host','localhost'); define('db_name','mydb') ; define('db_user','use1') ; define('db_pass','pwd1') ; $h = @mysql_pconnect(db_host,db_user,db_pass); if($h) mysql_select_db (db_name) or die ("could not select db");; --------------------------- -murugesan ----- Original Message ----- From: "Mjec" <mjec@bigpond.com> To: <php-general@lists.php.net> Sent: Monday, August 25, 2003 7:53 AM Subject: Re: [PHP] mysql_connect error on 25/08/2003 12:11 PM, John W. Holmes at holmes072000@charter.net wrote: > Mjec wrote: > >> Hi, >> >> again this line is causing problems: >> >> $h = >> mysql_connect('localhost',constant("mysql_user"),constant("mysql_password")) >> ; >> >> Aparantly a parse error. Idaes? > > Is there a reason you're using constant()?? > > Try: $h = mysql_connect('localhost', mysql_user, mysql_password); > > One thing to note about parse errors. If PHP says you have a parse error > on line 8 (for example), that means there is an error somewhere before > OR on line 8. The line PHP gives is just the point where it realized > something was wrong, but the cause could be on a previous line. Error line 43 (or 42 if 43 commented out and 42 uncommented) 38: define("mysql_password", "did you think"); 39: define("mysql_user", 'i would say this'); 40: 41: // Initialize MySQL database 42: // $h = mysql_connect('localhost',constant("mysql_user"),constant("mysql_password")) ; 43: $h = mysql_connect('localhost',mysql_user,mysql_password); 44: mysql_select_db('mjec_mjecnet', $h); ideas? --mjec -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#160632) next »