connectivty error
Moderator: General Moderators
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
connectivty error
i am using oracle database with odbc connection but it runs only else condition either i give right user name and password kindly check this coding and tell me what kind is mistake i am doing
thanks in advance
<?php
$A=$_POST["text1"];
$B=$_POST["text2"];
$conn=odbc_connect('AKTMAPP','ERP_TEST','ERP_TEST');
$sql="SELECT * FROM USERS WHERE USR_NAME='$A' and PASSWORD='$B'";
$rs=odbc_exec($conn,$sql);
if(odbc_fetch_row($rs)>0)
{
header("Location: http://index.php");
}
else
{
echo "error";
}
odbc_close($conn);
?>
thanks in advance
<?php
$A=$_POST["text1"];
$B=$_POST["text2"];
$conn=odbc_connect('AKTMAPP','ERP_TEST','ERP_TEST');
$sql="SELECT * FROM USERS WHERE USR_NAME='$A' and PASSWORD='$B'";
$rs=odbc_exec($conn,$sql);
if(odbc_fetch_row($rs)>0)
{
header("Location: http://index.php");
}
else
{
echo "error";
}
odbc_close($conn);
?>
Re: connectivty error
Try putting "or odbc_errormsg()" after connections and queries. Also, turn error reporting on full.
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
Re: connectivty error
i think there is no any connection error because when i am reteving record form table it shows be select statement , i think there is any error in logic so kindly tell me what is this i am using this on login page og my project??
thanks
thanks
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
Re: connectivty error
there is no any error message just else condition is runing "error" is printed.
Re: connectivty error
What does the code I posted display?
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
Re: connectivty error
it shows this message
resource(2) of type (odbc link) resource(3) of type (odbc result)
resource(2) of type (odbc link) resource(3) of type (odbc result)
Re: connectivty error
Oh right, well you do have a connection then.
Wait, don't you mean odbc_num_rows() instead of odbc_fetch_row()?
Wait, don't you mean odbc_num_rows() instead of odbc_fetch_row()?
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
Re: connectivty error
now i am using this code but still else condition is runing.
<?php
$A=$_POST["text1"];
$B=$_POST["text2"];
$conn=odbc_connect('AKTMAPP','ERP_TEST','ERP_TEST');
$sql="SELECT * FROM USERS WHERE USR_NAME='$A' and PASSWORD='$B'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
if(odbc_num_rows($rs)>0)
{
header("Location: http://index.php");
}
else
{
echo "error";
}
odbc_close($conn);
?>
<?php
$A=$_POST["text1"];
$B=$_POST["text2"];
$conn=odbc_connect('AKTMAPP','ERP_TEST','ERP_TEST');
$sql="SELECT * FROM USERS WHERE USR_NAME='$A' and PASSWORD='$B'";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
if(odbc_num_rows($rs)>0)
{
header("Location: http://index.php");
}
else
{
echo "error";
}
odbc_close($conn);
?>
Re: connectivty error
What does
display?
Your query must just be returning no rows...are you sure the username and password you're entering exists?
Code: Select all
var_dump(odbc_num_rows($rs));Your query must just be returning no rows...are you sure the username and password you're entering exists?
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
Re: connectivty error
it displays
int(-1)
yes user name and password is there
int(-1)
yes user name and password is there
Re: connectivty error
Hmm, well the php manual says that odbc_num_rows returns -1 on an error.
Hmm....
What does show?
Sorry for all the var_dump()s....but since I can't run the code myself, I can't see what it's returning
Hmm....
What does
Code: Select all
var_dump(odbc_fetch_rows($rs));Sorry for all the var_dump()s....but since I can't run the code myself, I can't see what it's returning
-
yasir_memon
- Forum Commoner
- Posts: 48
- Joined: Tue Aug 11, 2009 12:29 am
Re: connectivty error
its ok dear now it displys
Fatal error: Call to undefined function odbc_fetch_rows() in C:\wamp\www\RMS\login.php on line 109
Fatal error: Call to undefined function odbc_fetch_rows() in C:\wamp\www\RMS\login.php on line 109
Re: connectivty error
My bad, I meant odbc_fetch_row() 
Sorry.
I'm used to mysql...
Sorry.
I'm used to mysql...