Re: mysql_connect error

From: Date: Mon, 25 Aug 2003 02:23:30 +0000
Subject: Re: mysql_connect error
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-160628@lists.php.net to get a copy of this message
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

« previous php.general (#160628) next »