im using the latest xampp, php5 and mysql 5..
but why cant I connect in php to mysql?
here's the code..
im currently very frustrated beacause im just starting and then i got this connection error!
i really dont know what to do..
Parse error: parse error in C:\[location]\default.php on line 29
$user=”root”;
$host=”localhost”;
$password=””;
$connection = mysql_connect($host,$user,$password) or die (“couldn’t connect to server”);
$db = mysql_select_db($database,$connection) or die (“Couldn’t select database”);
pls help me with the connection (noob)
Moderator: General Moderators
-
finch_emo44
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 08, 2009 8:24 am
Re: pls help me with the connection (noob)
That's not a connection error. That's a parse error. It says "Parse error". That's a big clue. The error is on line 29 (or, more likely, 28 where you've missed a semicolon at the end).
-
finch_emo44
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 08, 2009 8:24 am
Re: pls help me with the connection (noob)
$connection = mysql_connect($host,$user,$password) or die (“couldn’t connect to server”); - this is line 29..
i dont know whats wrong with this..
i do have all the semi colons!
i dont know whats wrong with this..
i do have all the semi colons!
Re: pls help me with the connection (noob)
Maybe you should change
to
(bad quotation marks)?
Code: Select all
$connection = mysql_connect($host,$user,$password) or die (“couldn’t connect to server”);to
Code: Select all
$connection = mysql_connect($host,$user,$password) or die ("couldn’t connect to server"); (bad quotation marks)?
-
finch_emo44
- Forum Newbie
- Posts: 5
- Joined: Wed Jul 08, 2009 8:24 am
Re: pls help me with the connection (noob)
i already tried that one..
can anyone solve this noob thingy?? im new in this language..
can anyone solve this noob thingy?? im new in this language..
Re: pls help me with the connection (noob)
Can you post the whole file? We don't know how it looks like.
Can you give us line 28 atleast? I'm guessing that's where the error is.
Can you give us line 28 atleast? I'm guessing that's where the error is.