Page 1 of 1
I'm stuck! What is wrong with this login script?!
Posted: Tue Apr 20, 2004 3:15 am
by Dark-Rival
Hey all,
I have a question concerning the login script at the bottom of this post. I have to make php scripts in odbc style because I'm working with a MS Acces database. I just can't figure out what is wrong with this login script...
Code: Select all
<?
If ($Submit) {
include('connect.php')
//This is where he gives the error
$query = odbc_exec($connect,"select * from users where username = '$LoginNaam' and password = '$LoginPassword'")
$Res = odbc_num_rows($query);
if ($Res == '1') {
//If the entries are correct
echo "It finally works";
}
//If the entries are not correct
else {
print "Bummer...\n";
}
}
?>
Posted: Tue Apr 20, 2004 3:17 am
by JayBird
What is the error?
Posted: Tue Apr 20, 2004 3:19 am
by Dark-Rival
The error is:
Parse error: parse error in c:\apache\htdocs\mainlogin.php on line 6
which is this line:
$query = odbc_exec($connect,"select * from users where username = '$LoginNaam' and password = '$LoginPassword'")
Posted: Tue Apr 20, 2004 3:29 am
by JayBird
think you a missing a semi-colon from the end of that line
Mark
Posted: Tue Apr 20, 2004 3:36 am
by Dark-Rival
Tried to adjust that but still the same annoying error for a script as simple as this..
Posted: Tue Apr 20, 2004 3:40 am
by JayBird
you are missing a semi-colon from this line too!
Mark
Posted: Tue Apr 20, 2004 3:41 am
by CoderGoblin
include('connect.php') also missing semicolon
Parse error: parse error in c:\apache\htdocs\mainlogin.php on line 6 does not always mean the error is line 6. You may often need to look at the code before it especially when it comes to missing }, ;, ' or ".
Posted: Tue Apr 20, 2004 5:37 am
by Dark-Rival
Another funny question:
I'm trying to match ID's from 2 tables, so first I select the ID(numbers) from table A, then show the results from table B where I only want to show the rows with the same ID numbers as in Table A.
So the ID's are (of course) the primary key to link these 2 tables. The problem is, it will only fetch all of the ID numbers of table A but only show the last ID number of table B. How can I show all of the same ID numbers as in table A?
Script so far:
Code: Select all
<?
//I haven't pasted the top of the script, it would be to long then.
$result2 = odbc_exec($connect,"select * from TableA where RcpTo='$email'") or
die("selecting the A Table failed.");
while($row = odbc_fetch_row($result2))
{
$messageid = odbc_result($result2,"MessageID");
echo "$messageid";
echo "<br>";
}
odbc_free_result($result2);
$result = odbc_exec($connect,"select * from TableB where MessageID=$messageid") or
die("Selecting the Quarantine Table failed.");
while($row = odbc_fetch_row($result))
{
$messageidB = odbc_result($result,"MessageID");
echo "$messageidB";
echo "<BR>";
}
odbc_free_result($result);
?>
It will show 3 id numbers of table A but only the last of these 3 id number for table B
?>