Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-07-2003, 01:40 PM   #1
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default checking multiple entries in a db ??

Hi,
I am not sure how to go about this, best thing to do is explain, I think first with a little code :
PHP Code:
<?
include("connected.php");

$query "SELECT entryID, password, username FROM $table WHERE email = '$mail'";
$result=mysql_query($query);
if(
mysql_num_rows($result))
{
print
"&status=".("logon succesful")."&";
exit;
}
else
{
print
"&_root.status=".("you are not registered")."&";
exit;
}
/* Close link to MySQL */
mysql_close($link);
?>
The email column is unique, however I want to check the other values are correct as well. How ?
I had thought about writing a $query for each value, which seems a bit long winded to me, can I convert the other values to an array and then check them agains't user input, and if so HOW ?
Anyhow, I will keep trying, in the meantime, any help, pointers etc etc

Cheers

Vosgien

p.s. I think it is one of those things that is probably staring me in the face !!!
vosgien is offline   Reply With Quote
Old 07-07-2003, 02:46 PM   #2
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

try:
"SELECT_entryID,_password,_username_FROM_$table_WH ERE_email_= '$mail' and password='$password' and username='$user";

this will check to see if the username, password and email all match the values in the db.
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Old 07-07-2003, 02:48 PM   #3
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi,
Thanks tg, I was just playing around with something similar, tho' it would have taken a while longer to get there I think

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 07-07-2003, 03:50 PM   #4
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi,
I cannot tell if that will work or not as I am getting a parse error, something wrong with my syntax I think.
First of all, I should say that i have narrowed it down to 2 fields that HAVE to be checked, the email addy which is unique and the entryID number which is in fact an invoice number passed to the user after he has paid !
Code is like this :
PHP Code:
<?
include("connected.php");

$query "SELECT entryID, FROM $table WHERE email= '$mail'";
$result=mysql_query($query);
if(
mysql_num_rows($result))
{
while(
$rows mysql_fetch_array($result))
{
$entryID $row['entryID'];
print
"&status=".("logon succesful")."&";
exit;
}
else
{
print
"&_root.status=".("you are not registered")."&";
exit;
}
/* Close link to MySQL */
mysql_close($link);
?>
parese error is 'unexpectedT_ELSE'

What I need to achieve is to check if the email and entryID entered by user are the same as already in the db.

Cheers

Vosgien
vosgien is offline   Reply With Quote
Old 07-07-2003, 03:57 PM   #5
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,106
Default

i don't know much about php, but is this type of nesting ok?

//
if(mysql_num_rows($result))
{
while($rows_=_mysql_fetch_array($result))
{
$entryID_=_$row['entryID'];
print"&status=".("logon succesful")."&";
exit;
}///this is the end of the while
//place another '}' closing bracket here???
else
{
print"&_root.status=".("you are not registered")."&";
exit;
}

//

[edit] ah crap... it removed the spaces i added to show the nesting. [/edit]


i think you need to add/rearange some of your brackets here somewhere
__________________
tg
---
what the hell was i thinking?

Last edited by tg; 07-07-2003 at 04:00 PM.
tg is offline   Reply With Quote
Old 07-07-2003, 04:07 PM   #6
vosgien
member
 
Join Date: Dec 2001
Location: France
Posts: 923
Default

Hi tg,
Yep, that extra brace did the trick in that I am not parseing any errors, now to test the script itself - onward & upward

Bye the bye does anyone know anything about SIM configuration with authorize.net ???

Cheers

Vosgien
vosgien is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:46 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.