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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php