ma5ect Posted October 8, 2008 Share Posted October 8, 2008 Hi ppl.. i have a website setup and a database running with it, everything works fine on my desktop pc and now i am trying to get it working on my laptop.. but i get the following error when running the website could any1 plz suggest something error:Warning: mysql_pconnect() expects parameter 4 to be long, string given in C:\xampp\htdocs\checklogin.php on line 9 Fatal error: in C:\xampp\htdocs\checklogin.php on line 9 many thanks Link to comment https://forums.phpfreaks.com/topic/127522-php-error/ Share on other sites More sharing options...
Bendude14 Posted October 8, 2008 Share Posted October 8, 2008 can we see line 9 and a bit of the code? Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659770 Share on other sites More sharing options...
ma5ect Posted October 8, 2008 Author Share Posted October 8, 2008 sure... $mysql_connect = mysql_pconnect($hostname_mysql_connect, $username_mysql_connect, $password_mysql_connect, $tblname_mysql_connect) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_mysql_connect) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659772 Share on other sites More sharing options...
PFMaBiSmAd Posted October 8, 2008 Share Posted October 8, 2008 The posted code never worked, because the 4th parameter in the mysql_pconnect() is not a table name, which is what your variable name is implying - $tblname_mysql_connect Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659780 Share on other sites More sharing options...
ma5ect Posted October 8, 2008 Author Share Posted October 8, 2008 check login file: <? $hostname_mysql_connect = "localhost"; $database_mysql_connect = "website_members"; $username_mysql_connect = "root"; $password_mysql_connect = "******"; $tblname_mysql_connect ="members"; $mysql_connect = mysql_pconnect($hostname_mysql_connect, $username_mysql_connect, $password_mysql_connect, $tblname_mysql_connect) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db($database_mysql_connect) or die(mysql_error()); $myusername = $_POST['myusername']; $mypassword = $_POST['mypassword']; $sql = "SELECT * FROM $tblname_mysql_connect WHERE username= '$myusername' and passwords='$mypassword'"; $result = mysql_query($sql) or die(mysql_error()); $count = mysql_num_rows($result); if($count==1) { session_register("myusername"); session_register("mypassword"); header("location: login_success_welcome.php"); } else { echo "Wrong Username or Password"; } ?> Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659781 Share on other sites More sharing options...
ma5ect Posted October 8, 2008 Author Share Posted October 8, 2008 but i do have that table in the database.. it does exist Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659785 Share on other sites More sharing options...
PFMaBiSmAd Posted October 8, 2008 Share Posted October 8, 2008 The only way you can use a programming language effectively is if you read the documentation for the functions you are using - http://us3.php.net/mysql_pconnect The 4th parameter, which the error message and I have both told you is incorrect, it is not a table name. Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659787 Share on other sites More sharing options...
ma5ect Posted October 8, 2008 Author Share Posted October 8, 2008 when i test the databse with the website it successfully connects and displays all the tables.. cud you suggest another method of connecteing the database with the website.. Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659791 Share on other sites More sharing options...
ma5ect Posted October 8, 2008 Author Share Posted October 8, 2008 got it working thanks 4 all da help Link to comment https://forums.phpfreaks.com/topic/127522-php-error/#findComment-659807 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.