I'm stuck! What is wrong with this login script?!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Dark-Rival
Forum Newbie
Posts: 21
Joined: Thu Apr 15, 2004 5:03 am
Location: Amsterdam

I'm stuck! What is wrong with this login script?!

Post 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";  


        }  
} 
?>
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

What is the error?
User avatar
Dark-Rival
Forum Newbie
Posts: 21
Joined: Thu Apr 15, 2004 5:03 am
Location: Amsterdam

Post 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'")
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

think you a missing a semi-colon from the end of that line

Mark
User avatar
Dark-Rival
Forum Newbie
Posts: 21
Joined: Thu Apr 15, 2004 5:03 am
Location: Amsterdam

Post by Dark-Rival »

Tried to adjust that but still the same annoying error for a script as simple as this..
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

you are missing a semi-colon from this line too!

Code: Select all

include('connect.php')
Mark
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

include('connect.php') also missing semicolon :wink:

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 ".
User avatar
Dark-Rival
Forum Newbie
Posts: 21
Joined: Thu Apr 15, 2004 5:03 am
Location: Amsterdam

Post 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
?>
Post Reply