wernervantonder Posted September 14, 2006 Share Posted September 14, 2006 Hi there i am a newbie in php and allready i find it very intresting! you might see me around here often. so my first question is this:My database does not connect when i use the line: mysql_connect(localhost,$username,$password); i have se my $username and $password vairiables and assure that it is correct. mysql is running alongside my apache server. i can view php pages via http://localhost/.what did i do wrong when the error refrences to this line (....mysql_connect(localhost,$username,$password);......) and tells me that there is a parsing error.?Thanks in advance Werner Quote Link to comment https://forums.phpfreaks.com/topic/20699-mysql-connect/ Share on other sites More sharing options...
Zane Posted September 14, 2006 Share Posted September 14, 2006 put the word localhost in double quotesmysql_connect("localhost",$username,$password); Quote Link to comment https://forums.phpfreaks.com/topic/20699-mysql-connect/#findComment-91571 Share on other sites More sharing options...
Daniel0 Posted September 14, 2006 Share Posted September 14, 2006 You need to put everything in either single-quotes or double-quotes. The only types where it's not necessary is integers and floating numbers. If it's a boolean then there may not be quotes around it. Quote Link to comment https://forums.phpfreaks.com/topic/20699-mysql-connect/#findComment-91573 Share on other sites More sharing options...
wildteen88 Posted September 14, 2006 Share Posted September 14, 2006 Could you post the actuall error message here and the code you are using here too.Also @Daniel0 you do not need to put quotes around variables, floats, booleans etc. Quote Link to comment https://forums.phpfreaks.com/topic/20699-mysql-connect/#findComment-91632 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.