HI Jeff here is the error replace $row = mysql_fetch_assoc($result3); on line 42 with $row = mysql_fetch_assoc(result3); here only a $ missing in mysql_fetch_assoc in parameter list.
now try it i think it will work. bye Babal --- In [email protected], Jeffrey Cook <[EMAIL PROTECTED]> wrote: > > Babal, > > I got this error after typing in your suggestion, perhaps I did something else wrong: > > Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /data/11/0/109/110/761599/user/778876/htdocs/Login.php on line 42 > > Here's my code: > > if ($num2 > 0) // password is correct > { > $sql = "SELECT loginName FROM membership > WHERE loginName='$_POST[fusername]' > AND password=password('$_POST[fpassword]') > AND type='$type'"; > $result3 = mysql_query($sql) or die ("Couldn't execute query 3."); > > $row = mysql_fetch_assoc(result3); // line 42! > if ($row['type'] == "standard") > { > > Jeff > > > jadu_babal <[EMAIL PROTECTED]> wrote: > Hi Jeff > > in ur code u are comparing this if ($thetype == "standard") > > if i got ur purpose correctly > > $thetype this is the variable which u are using for fetching the > records, now u have to compare it with databse values. > > but u r comparing it with the variable $thetype > > insteed of this u should use > > $row = mysql_fetch_assoc(result3); > and compare it as > > if ($row['type'] == "standard") > > try the code i thing it will work and solve ur problem. > > bye > BABAL > > --- In [email protected], Jeffrey Cook <jnoelcook@> wrote: > > > > Pam, > > > > I agree with you. I do not believe we are discussing a design > issue. I have already finished the design and have built the > environments and it is working. So I wish to continue discussing my > coding issues publically in this forum. That's what groups like these > are for, for sharing code. > > > > Okay, so I have got this problem working by creating different > environments, copies of each page for the different type of membership > and one for when the member is signed out. All the "signed out" users > are taken to .htm files and the logged in members are taken to .php > files. I had a drop down box below the username and password for > login as a certain type. If they selected STANDARD type and submitted > the form, they would be taken to the STANDARD environment. But, that > was only for testing purposes...and I had it working. But I want the > code to check from the database which type the member signed up as and > take them automatically. It is not working, but I have found the > location of the problem...it is in these lines: > > > > > $sql = "SELECT loginName FROM membership > > > WHERE loginName='$_POST[fusername]' > > > AND type='$thetype' "; > > > $result3 = mysql_query($sql)or die("Couldn't execute query 3."); > > > > > > if ($thetype == "standard") > > > > The code pulls the username (loginName) and membership type (type) > from the membership table exactly as they were working when the user > selected the type manually. However, for some reason, the code simply > skips over the last statement above and does not see that $thetype and > standard are equal and goes to the else, which is not included above > but follows. > > > > I am looking at it and trying many different things, but I still > can't seem to pull it off. > > > > Can anyone help? Did I type a command incorrectly? > > > > Thanks for any help. > > > > Jeff > > > > Pam <ltf01@> wrote: > > Well, I wouldn't want anyone yelling at you either. Its no problem. > > I was just thinking though that mingling php with html in a file is > as much > > a part of learning php as the code itself. Or at least it is > important with > > .asp. > > > > Take care, > > Pam > > > > > -----Original Message----- > > > From: [email protected] [mailto:[EMAIL PROTECTED] > > > Behalf Of Gerry Danen > > > Sent: Sunday, June 04, 2006 4:15 PM > > > To: [email protected] > > > Subject: Re: [php_mysql] Question about Login / Signout... > > > > > > > > > Pam, I have no problem doing that on > > > http://groups.yahoo.com/group/php_and_mysql/ because I own that > list. On > > > this list it might be considered off-topic, and I don't need > > > someone yelling > > > at me. :) > > > > > > Gerry > > > > > > On 6/4/06, Pam <ltf01@> wrote: > > > > > > > > Hi Gerry, > > > > I'm new to the list, and very new to php. I have learned a lot > just from > > > > following everyone's conversations and would really like it if > you kept > > > > this > > > > on list if it is ok with everyone else because I feel like I > could learn > > > > from it. > > > > > > > > > > > > > > > > > [Non-text portions of this message have been removed] > > > > > > > > > > > > > > > The php_mysql group is dedicated to learn more about the > > > PHP/MySQL web database possibilities through group learning. > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The php_mysql group is dedicated to learn more about the PHP/MySQL > web database possibilities through group learning. > > > > > > > > SPONSORED LINKS > > American general life and accident insurance company > American general life insurance company American general life > American general mortgage American general life insurance Computer > internet security > > > > --------------------------------- > > YAHOO! GROUPS LINKS > > > > > > Visit your group "php_mysql" on the web. > > > > To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED] > > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of > Service. > > > > > > --------------------------------- > > > > > > > > > > > > --------------------------------- > > Be a chatter box. Enjoy free PC-to-PC calls with Yahoo! Messenger > with Voice. > > > > [Non-text portions of this message have been removed] > > > > > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > [Non-text portions of this message have been removed] > ------------------------ Yahoo! Groups Sponsor --------------------~--> Protect your PC from spy ware with award winning anti spy technology. It's free. http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/CefplB/TM --------------------------------------------------------------------~-> The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php_mysql/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
