php error
Moderator: General Moderators
php error
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
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
Re: php error
Post some code ...
There are 10 types of people in this world, those who understand binary and those who don't
Re: php error
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());
$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());
Re: php error
Now look at this one (http://bg2.php.net/mysql_pconnect):
and check if $tblname_mysql_connect is int.resource mysql_pconnect ([ string $server [, string $username [, string $password [, int $client_flags ]]]] )
You may do this by adding var_dump($tblname_mysql_connect); in your code and examine the output page.
There are 10 types of people in this world, those who understand binary and those who don't
Re: php error
i am little confused..wat part of the code needs to be altered..
checklogin file...
checklogin file...
Code: Select all
<?
$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";
}
?>Re: php error
The last argument you pass to mysql_pconnect appears to be a string. According to the PHP manual it should be a long integer (connection flags).
You can't use a table name before you have selected a database, so it's not possible to pass table name to the connection function.
Simply, remove the last argument of mysql_pconnect.
You can't use a table name before you have selected a database, so it's not possible to pass table name to the connection function.
Simply, remove the last argument of mysql_pconnect.
There are 10 types of people in this world, those who understand binary and those who don't
Re: php error
i have tried wat u suggested in your last post but stil no luck
Re: php error
What did you try (code, please) and what error ouput did you get?
There are 10 types of people in this world, those who understand binary and those who don't
Re: php error
Same error message?
Don't forget session_start() in the beginning of your document.
Don't forget session_start() in the beginning of your document.
Re: php error
<?php
session_start();
$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);
same errror message
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
session_start();
$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);
same errror message
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
Re: php error
also i have tested the database connection and it successfully connects showing all tables but when running website i get the errors
Re: php error
...
VladSun wrote:The last argument you pass to mysql_pconnect appears to be a string. According to the PHP manual it should be a long integer (connection flags).
You can't use a table name before you have selected a database, so it's not possible to pass table name to the connection function.
Simply, remove the last argument of mysql_pconnect.
There are 10 types of people in this world, those who understand binary and those who don't
Re: php error
$mysql_connect = mysql_pconnect($hostname_mysql_connect, $username_mysql_connect, $password_mysql_connect) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database_mysql_connect) or die(mysql_error());
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
mysql_select_db($database_mysql_connect) or die(mysql_error());
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
Re: php error
Did you save the file?
There are 10 types of people in this world, those who understand binary and those who don't