[PHP] Frustrating problem with log-in script
Hi, I' running a self-registration script. On the login page are 2 fields: 'username' and 'paswd'. The contents are checked against a db. New users must enter 'new' and 'user' into these fields and that will skip the db check and dump them into a registration page. On testing (after it worked fine last week) I find that new/user dumps me back into the login page (home.html). The code is ... ?php include(functions.php); include(local.php); $login=$url.home.html; if(isset($_REQUEST[username]) $_REQUEST[username]!=''){ $username=$_REQUEST[username]; } else { header(Location: $login); } if(isset($_REQUEST[paswd]) $_REQUEST[paswd]!=''){ $paswd=$_REQUEST[paswd]; } else { header(Location: $login); } if( $username == 'new' ){ $new_u=$url.user_new.php; header(Location: $new_u); } $strSQL = select * FROM user WHERE (Username='$username' AND Paswd='$paswd'); $cur = odbc_exec( $conn, $strSQL ); if (!$cur) { Error_handler( #1 Error in odbc_exec( no cursor returned ) .$strSQL , $conn ); } .. ? Any suggestions? This is running on Win NT. Chers George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Frustrating problem with log-in script - DOHHH - Solved
Sorry guys, I wasted your time if you looked at this. The local.php as copied from my local machine and had 'localhost' as the base url rather than the proper web address. Meet Dumbererer! George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] frustrating problem
I hope that I can explain this problem in a logical and clear way. In MySQL, I have two tables for information:: foo, which contains FooID, FooLName, FooFName and foocontact, which contains FooID, FooContactID, FooEmail, FooPhone, FooAddress1, etc. Honestly, I can't remember why I split up the names and contact info into two separate tables, but that's the way it is... In the first hundred or so entries of foocontact, FooID and FooContactID are identical (both columns are auto-increment). But because I've occasionally had problems loading data into the database, and have had to reload some entries while delete or forgetting to delete others, the numbers are now out of synch. For some entries, that doesn't seem to be a problem (I might have fixed them by hand at an earlier date, but I can't remember), but for others, it might be. That may not matter, though. What I'd like to do is call up info from both foo and foocontact using only the FooID, which is passed in the url. I can't understand, though, why the where clause in the folllowing line isn't working the way I want it to: SELECT FooLName, FooPhone, FooEmail FROM foo, foocontact WHERE foocontact.FooID=$FooID and foo.FooID=$FooID; I've also tried: WHERE foocontact.FooID=$FooID and foo.FooID=foocontact.FooID; any idea why that doesn't work? does any of this make sense? sorry if it doesn't, and thanks in advance for your help. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] frustrating problem
--- Matthew K. Gold [EMAIL PROTECTED] wrote: SELECT FooLName, FooPhone, FooEmail FROM foo, foocontact WHERE foocontact.FooID=$FooID and foo.FooID=$FooID; You might try this instead: select foolname, foophone, fooemail from foo, foocontact where foo.fooid='$fooid' and foo.fooid=foocontact.fooid Also, are you certain that $fooid is set? You might have to use $_GET[fooid] if register_globals is not on. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] frustrating problem
I'm not sure what syntax would work for you with one query. You might try the mysql list. I personally make two queries. One would be a query to the foo table to get the name and the second would be a loop to iterate through each contact info entry. For each iteration you will get the array with the individual FooContactID and when you post from that looped result you can do your update if it needs to be done etc. I hope that makes sense. $query = select FooLName from foo where FooID=$id; $queryr = mysql_query($query) or die(Failed Foo); $frow = mysql_fetch_row($queryr); echo $frow[0].: br; $query2 = select FooPhone, FooEmail from foocontact where FooID=$id; $query2r = mysql_query($query2) or die(Failed FooContact); $n = 0; while ($fcrow = mysql_fetch_row($query2r)) { $n++; echo $n.. .$fcrow[0]. .$fcrow[1].br; } That's off the top of my head. I think that's how I'd do it. I would imagine you wanted separate tables so that one person could have multiple addresses. Again I might have a typo or two in there. Just to give you an idea. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Matthew K. Gold [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 4:26 PM To: [EMAIL PROTECTED] Subject: [PHP] frustrating problem I hope that I can explain this problem in a logical and clear way. In MySQL, I have two tables for information:: foo, which contains FooID, FooLName, FooFName and foocontact, which contains FooID, FooContactID, FooEmail, FooPhone, FooAddress1, etc. Honestly, I can't remember why I split up the names and contact info into two separate tables, but that's the way it is... In the first hundred or so entries of foocontact, FooID and FooContactID are identical (both columns are auto-increment). But because I've occasionally had problems loading data into the database, and have had to reload some entries while delete or forgetting to delete others, the numbers are now out of synch. For some entries, that doesn't seem to be a problem (I might have fixed them by hand at an earlier date, but I can't remember), but for others, it might be. That may not matter, though. What I'd like to do is call up info from both foo and foocontact using only the FooID, which is passed in the url. I can't understand, though, why the where clause in the folllowing line isn't working the way I want it to: SELECT FooLName, FooPhone, FooEmail FROM foo, foocontact WHERE foocontact.FooID=$FooID and foo.FooID=$FooID; I've also tried: WHERE foocontact.FooID=$FooID and foo.FooID=foocontact.FooID; any idea why that doesn't work? does any of this make sense? sorry if it doesn't, and thanks in advance for your help. Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Frustrating ?
It means your query failed. Change $news = mysql_query('select * from ccl where '.$where.' order by AU desc'); TO: $news = mysql_query('select * from ccl where '.$where.' order by AU desc') or die(error: .mysql_error()); this will display the error -Original Message- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 12:30 AM To: [EMAIL PROTECTED] Subject: [PHP] Frustrating ? Heres's a frustrating, and maybe not so stupid question? I'm getting Warning: Supplied argument is not a valid MySQL result resource on this line: while ($mydata = mysql_fetch_object($news)) So what am I doing wrong here: $where = id like $id; $news = mysql_query('select * from ccl where '.$where.' order by AU desc'); //desc = z-a while ($mydata = mysql_fetch_object($news)) { echo tr bgcolor=\#CC\td align=centera href=\index.html?id=$mydata-id\Print View/a/tdtd$mydata-id/tdtd$mydata-AU/tdtd$mydata-ST/tdtd $mydata-BT/td/tr\n; }#end of while I've tried variations like: $news = mysql_query('select * from ccl where id like $id order by AU desc'); $news = mysql_query(select * from ccl where id like $id order by AU desc); $id checks out ok. I use index.html?id=4 AU exists; ok. So ... ? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Frustrating ?
Heres's a frustrating, and maybe not so stupid question? I'm getting Warning: Supplied argument is not a valid MySQL result resource on this line: while ($mydata = mysql_fetch_object($news)) So what am I doing wrong here: $where = id like $id; $news = mysql_query('select * from ccl where '.$where.' order by AU desc'); //desc = z-a while ($mydata = mysql_fetch_object($news)) { echo tr bgcolor=\#CC\td align=centera href=\index.html?id=$mydata-id\Print View/a/tdtd$mydata-id/tdtd$mydata-AU/tdtd$mydata-ST/tdtd$mydata-BT/td/tr\n; }#end of while I've tried variations like: $news = mysql_query('select * from ccl where id like $id order by AU desc'); $news = mysql_query(select * from ccl where id like $id order by AU desc); $id checks out ok. I use index.html?id=4 AU exists; ok. So ... ? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php