HI, I am getting the following error when including a file.what is the probelm? Parse error: syntax error, unexpected T_INCLUDE, expecting T_FUNCTION in D:\xampp\htdocs\dlinks\files\UsersOperations.php on line 4
Again i got this error : Parse error: syntax error, unexpected T_VAR in D:\xampp\htdocs\dlinks\includes\db_details.php on line 2 included file: include("../includes/db_details.php"); content: <?php var $db_name = "xxxx"; var $db_user = "xxx"; var $db_pass = "xxxx"; var $db_host = "xxxxx"; ?>
also i am getting the following error when connecting to the mysql: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in D:\xampp\htdocs\dlinks\files\UsersOperations.php on line 8
The mysql_connect issue will be you providing the wrong username/password for the database you are trying to read from. I generally create a function that handles all the mysql stuff, and all I pass to it is the query. That way if you get errors you know that the problem is in one place. How are you calling the mysql_connect?
Have you ever considered, you know, sorta trying to learn PHP? There are plenty of great resources, the error messages tell you exactly what and where is wrong, and everything is extremely well documented in the PHP manual. I can understand running into a few problems but this is what, nearly your 10th topic in just a few days?? And pretty much every error you've posted is self-explanitory and/or a matter of common sense. You only ever need to use "var" when you're setting up class properties - and even then only if you're still on PHP4. If you just want to define those variables, you don't need var. The error message "syntax error, unexpected T_VAR" would kinda suggest that that's your problem.. Access denied for user 'ODBC'@'localhost' (using password: NO) - so what do you think could possibly be the problem there? I'm guessing your mysql user is not "ODBC" and you do have a password - so it's not using the user/pass you're specifying. Can't say why for certain without seeing the code - if the call to mysql_connect is within another class or function, can it access the $db_ variables? You may need to set them as globals or (better) pass them as arguments to the function.
Warning: mysql_connect() [function.mysql-connect]: Host 'krishna' is not allowed to connect to this MySQL server in D:\xampp\htdocs\dlinks\files\UsersOperations.php on line 8
read php mysql and apache by Julie C. Meloni also, when you get an error google it. worked for me...er...well i kinda stopped learning for awhile but the book kicks ass