Page 1 of 1

pls help me with the connection (noob)

Posted: Wed Jul 08, 2009 8:31 am
by finch_emo44
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”);

Re: pls help me with the connection (noob)

Posted: Wed Jul 08, 2009 8:43 am
by onion2k
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).

Re: pls help me with the connection (noob)

Posted: Wed Jul 08, 2009 8:45 am
by finch_emo44
$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!

Re: pls help me with the connection (noob)

Posted: Wed Jul 08, 2009 8:53 am
by genconv
Maybe you should change

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)?

Re: pls help me with the connection (noob)

Posted: Wed Jul 08, 2009 8:59 am
by finch_emo44
i already tried that one..

can anyone solve this noob thingy?? im new in this language..

Re: pls help me with the connection (noob)

Posted: Wed Jul 08, 2009 11:05 am
by SvanteH
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.