By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

php error

P: 77
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
Oct 8 '08 #1
Share this Question
Share on Google+
7 Replies


Markus
Expert 5K+
P: 6,050
Post the code giving the error so we can help.
Oct 8 '08 #2

P: 77
[PHP]<?

$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";
}

?>[/PHP]
Oct 8 '08 #3

Markus
Expert 5K+
P: 6,050
mysql_pconnect's 4th parameter [quote from php.net]

The client_flags parameter can be a combination of the following constants: 128 (enable LOAD DATA LOCAL handling), MYSQL_CLIENT_SSL, MYSQL_CLIENT_COMPRESS, MYSQL_CLIENT_IGNORE_SPACE or MYSQL_CLIENT_INTERACTIVE.
It doesn't take a table name as the parameter.
Oct 8 '08 #4

P: 77
so hw cud i reslove this...
Oct 8 '08 #5

P: 77
got it working


thanks 4 da help
Oct 8 '08 #6

Atli
Expert 5K+
P: 5,058
Hi.

Might I point out that this:
Expand|Select|Wrap|Line Numbers
  1. $myusername = $_POST['myusername'];
  2. $mypassword = $_POST['mypassword'];
  3.  
  4. $sql = "SELECT * FROM $tblname_mysql_connect WHERE username= '$myusername' and passwords='$mypassword'"; 
  5.  
is a very very bad piece of code.

This makes you vulnerable to SQL injection, which is not a good thing to be.
Check out SQL Injection in the PHP manual to see why.
Oct 8 '08 #7

pbmods
Expert 5K+
P: 5,821
Heya, Mubs.

Glad you were able to get it working! How did you end up solving it?
Oct 9 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.