Topshed Posted January 11, 2011 Share Posted January 11, 2011 PHP 5.2.15 and 5.3.4 (dual environment) MySQL 5.1.52 I have just switched over from a Windows to a unix host and I have changed my users to reflect the new address and the password etc; on my new host I have used both user_conn (with limited access) and sys_admin_conn.php (with full access) Using any of my phpmyedit files with either user works fine showing tables But when I try to use one of my 900 plus gallery scripts they fall over with a strange message Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'topshed'@'localhost' (using password: NO) in /home/topshed/public_html/gal_lt/LT1317.php on line 36 Error !! Unable to connect to database the bit (using password: NO) makes no sense to me as all the user info including password is there the code involved is below... <?php $tble = 'LT'; $fnum = '78'; include_once("../include/user_conn.php"); $connect = mysqli_connect($host,$account,$password) OR DIE("Error !! Unable to connect to database"); $db = mysqli_select_db($connect,"$dbname") OR DIE( "Unable to select database "); // echo $tble; $db="SELECT * FROM $tble WHERE fleet = $fnum"; if ($result = mysqli_query($connect,$db)) { if (mysqli_num_rows($result)) { while ($row = mysqli_fetch_assoc($result)){ gallery code include ("../include/HC_footer.php"); }}} ?> My hosting company help desk chat cannot make any sense of it but of course that is not their problem the thing is all my scripts still work in a windows host enviroment Any help would be most welcome Quote Link to comment Share on other sites More sharing options...
mikosiko Posted January 11, 2011 Share Posted January 11, 2011 Access denied for user 'topshed'@'localhost' (using password: NO) usually could means: - The user (topshed in this case) exist but the provided password is incorrect (or null); or - The user topshed doesn't have the proper GRANTS for the selected DB. Quote Link to comment Share on other sites More sharing options...
jdavidbakr Posted January 11, 2011 Share Posted January 11, 2011 "using password: NO" means that no password was passed to the connect function. Double-check to make sure $password has been correctly initialized. In your sample code you're not initializing any of the connection variables, if you just removed them for security reasons you'll want to make sure you have them set correctly. If the sample code is indeed your entire code, you're not able to connect because you haven't defined any of the connection parameters. Quote Link to comment Share on other sites More sharing options...
Topshed Posted January 13, 2011 Author Share Posted January 13, 2011 Thank you both for your input, Your suggestions set me thinking and I found the problem A variable incorrectly called Thanks a lot Topshed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.