Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   why it is not working (http://www.go4expert.com/forums/why-it-is-not-working-t19222/)

anchitjindal07 29Aug2009 20:25

why it is not working
 
Please read the following code

<?php
$a=mysql_connect(localhost,root,"");
if(!$a)
echo "Could not connect";
?>

When i run the above pgm it gives the following errors:

Notice: Use of undefined constant localhost - assumed 'localhost' in C:\Program Files\EasyPHP 3.0\www\dbase.php on line 2

Notice: Use of undefined constant root - assumed 'root' in C:\Program Files\EasyPHP 3.0\www\dbase.php on line 2

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\Program Files\EasyPHP 3.0\www\dbase.php on line 2
Could not connect



Please tell where is the problem. I am using easyphp 3.0

shabbir 30Aug2009 08:47

Re: why it is not working
 
localhost / root should be within quotes or else they should be declared as variables.


All times are GMT +5.5. The time now is 21:30.