pls help me with the connection (noob)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
finch_emo44
Forum Newbie
Posts: 5
Joined: Wed Jul 08, 2009 8:24 am

pls help me with the connection (noob)

Post 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”);
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: pls help me with the connection (noob)

Post 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).
finch_emo44
Forum Newbie
Posts: 5
Joined: Wed Jul 08, 2009 8:24 am

Re: pls help me with the connection (noob)

Post 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!
User avatar
genconv
Forum Commoner
Posts: 34
Joined: Sun Jul 05, 2009 9:27 am

Re: pls help me with the connection (noob)

Post 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)?
finch_emo44
Forum Newbie
Posts: 5
Joined: Wed Jul 08, 2009 8:24 am

Re: pls help me with the connection (noob)

Post by finch_emo44 »

i already tried that one..

can anyone solve this noob thingy?? im new in this language..
SvanteH
Forum Commoner
Posts: 50
Joined: Wed Jul 08, 2009 12:25 am

Re: pls help me with the connection (noob)

Post 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.
Post Reply