carylson Posted January 3, 2008 Share Posted January 3, 2008 Im not sure why I am receiving this error, any help is appreciated: Output: Warning: mysql_query(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /hsphere/local/home/dtsabai/parrecsol.com/cp/login.php on line 12 Warning: mysql_query(): A link to the server could not be established in /hsphere/local/home/dtsabai/parrecsol.com/cp/login.php on line 12 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/dtsabai/parrecsol.com/cp/login.php on line 13 Invalid login. The specified user could not be found. Please double check your information and try again. The Code: <?php $dbhost = 'mysql401.ixwebhosting.com:3306'; $dbuser = '***'; $dbpass = '***'; $dbname = '***'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); if ($_REQUEST['fcn'] == "login") { if ($_REQUEST['frmUsername'] == "" || $_REQUEST['frmPassword'] == "") { echo "Invalid login. Please complete all form data and try again."; } else { $UserInfoSQL = mysql_query("SELECT * FROM Users WHERE Username = '". $_REQUEST['frmUsername'] ."' AND Password = '". $_REQUEST['frmPassword'] ."'"); $UserInfo = mysql_fetch_array($UserInfoSQL); if ($UserInfo) { $_SESSION['LoggedIn'] = True; $_SESSION['ID'] = $UserInfo['ID']; $_SESSION['Username'] = $UserInfo['Username']; $_SESSION['AdminLevel'] = $UserInfo['AdminLevel']; echo "Login successful. Hello, ". $_SESSION['Username'] ."!"; } else { echo "Invalid login. The specified user could not be found. Please double check your information and try again."; } } } ?> .... some html Lines 12/13: $UserInfoSQL = mysql_query("SELECT * FROM Users WHERE Username = '". $_REQUEST['frmUsername'] ."' AND Password = '". $_REQUEST['frmPassword'] ."'"); $UserInfo = mysql_fetch_array($UserInfoSQL); Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/ Share on other sites More sharing options...
revraz Posted January 3, 2008 Share Posted January 3, 2008 No point on having 2 threads with the same problem. Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428864 Share on other sites More sharing options...
carylson Posted January 3, 2008 Author Share Posted January 3, 2008 But there is. I changed the code and wanted to avoid confusion. Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428866 Share on other sites More sharing options...
neilfurry Posted January 3, 2008 Share Posted January 3, 2008 Can you make use of this: $dbhost = 'localhost'; instead of this $dbhost = 'mysql401.ixwebhosting.com:3306'; Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428868 Share on other sites More sharing options...
carylson Posted January 3, 2008 Author Share Posted January 3, 2008 gave localhost a try and it resulted in identical errors. not sure if thats good or bad... Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428869 Share on other sites More sharing options...
dewey_witt Posted January 3, 2008 Share Posted January 3, 2008 I also have accounts on IXWEBHOSTING. I dont understand why your trying to use soccets. and No localhost wont work. neither will annonamous log-ins. Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428935 Share on other sites More sharing options...
carylson Posted January 3, 2008 Author Share Posted January 3, 2008 perhaps you could make a suggestion if you DO know what to do. Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428991 Share on other sites More sharing options...
mmarif4u Posted January 3, 2008 Share Posted January 3, 2008 try use the $dbhost variable without socket. mean 3306 Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428993 Share on other sites More sharing options...
carylson Posted January 3, 2008 Author Share Posted January 3, 2008 3306 is the default socket- it shouldn't make a difference if its there or not. tried it anyway and get the same error Link to comment https://forums.phpfreaks.com/topic/84218-dont-know-how-to-fix-this-help/#findComment-428997 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.