PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 27th, 2002, 08:17 PM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
User Log in

Oh no, russ has another problem....sorry guys. Anyone know any decent user login tutorials? and a comments tutorial too?


Reply With Quote
  #2  
Old July 27th, 2002, 09:07 PM
Gunblade Gunblade is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: England
Posts: 31 Gunblade User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to Gunblade Send a message via AIM to Gunblade Send a message via Yahoo to Gunblade
RE: User Log in

Ive seena comments tutorial somewhere, ill try and find u it again.

With a login tutorial, try www.hotscripts.com then go to php>>user authentication

Reply With Quote
  #3  
Old July 27th, 2002, 09:11 PM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: User Log in

Single line comments, use //
Multiple line comments use /* */
php Code:
Original - php Code
  1. <?php
  2. //This line is a comment
  3. echo "This is not a comment";
  4. /*
  5. This
  6. is
  7. a
  8. multiple
  9. line
  10. comment
  11. */
  12. ?>

Reply With Quote
  #4  
Old July 27th, 2002, 09:34 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: User Log in

lol Evi..

Reply With Quote
  #5  
Old July 28th, 2002, 12:55 AM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: User Log in

hey guys, thanks for your help. I found one at phpbeginner. but when I add this to my script

setcookie ("ck_user", "");
setcookie ("ck_password", "");
setcookie ("ck_user_id", "");

i get this error

Warning: Cannot add header information - headers already sent by (output started at /home/gmflp/public_html/main.php:3) in /home/gmflp/public_html/scripts/head.php on line 31

Reply With Quote
  #6  
Old July 28th, 2002, 01:07 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: User Log in

read this

Reply With Quote
  #7  
Old July 28th, 2002, 01:18 AM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: User Log in

Cheers man

Reply With Quote
  #8  
Old July 28th, 2002, 01:38 AM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: User Log in

okay, another error, after I submit the form, I get this error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/gmflp/public_html/test.php on line 76

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/gmflp/public_html/test.php on line 78


that is on this line

php Code:
Original - php Code
  1.  
  2.             //get the user_id from the result
  3.             $num_rows = mysql_num_rows($result);
  4.             $row = mysql_fetch_array($result);
  5.             $user_id = $row[0];
  6.  

Reply With Quote
  #9  
Old July 28th, 2002, 03:58 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: User Log in

im pretty sure that means theres an error in your SQL syntax.
do this:
php Code:
Original - php Code
  1.  
  2. $result = mysql_query($SQL) or die(mysql_error());

that should get you your problem

Reply With Quote
  #10  
Old July 28th, 2002, 04:32 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: User Log in

ditto.

line 76: $num_rows = mysql_num_rows($result);
line 78: $row = mysql_fetch_array($result);

What do these two lines have in common? tic-toc A: $result
The error msg reads "supplied argument is not a valid MySQL result resource". What is the supplied argument? A: $result

What is $result? A variable. That is most likely assigned the value mysql_query($query)

So mysql_query() did _NOT_ return a valid MySQL result resource. Why not? Probably, 9 out of 10 times, is because $query is not a properly formatted SQL statement or some indicies your trying to collect are not legit.

So even though the error is on line 76 and 78, the problem is before that ... probably line 74.

Good luck.

PS ... it is good practice to run your queries in your mysql client to writing them in code.

Reply With Quote
  #11  
Old July 29th, 2002, 12:48 AM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: User Log in

okay, I have got it narrowed down to this now

MySQL said:


You have an error in your SQL syntax near '$sql = "SELECT id "
. "FROM membersdb "
. "WHERE use' at line 1


I personally can't see anything wrong with it. I think I might be the word sql, but I've tried numbering it and stuff, and its just not working, I find this wierd as this is the code in the tutorial

Reply With Quote
  #12  
Old July 29th, 2002, 12:48 PM
Gunblade Gunblade is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: England
Posts: 31 Gunblade User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to Gunblade Send a message via AIM to Gunblade Send a message via Yahoo to Gunblade
RE: User Log in

Am not good wit sql but try:

'$sql = "SELECT id" ;
."FROM membersdb" ;
."WHERE USE" at line 1';

Reply With Quote
  #13  
Old July 29th, 2002, 01:03 PM
ASk ASk is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 12 ASk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: User Log in

for mysql queries use:

$result=mysql_query("SELECT id FROM membersdb WHERE yourwheresyntax")

Reply With Quote
  #14  
Old July 29th, 2002, 08:09 PM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: User Log in

Russ,

When you execute a query using your mysql client, just send the sql statement. For example, SELECT id FROM memberdb.

It looks like you tried diving it some PHP code ... $sql = SELECT id from membersdb. Which, as you can, mysql will not understand it and send you an error msg.

HTH

Reply With Quote
  #15  
Old July 29th, 2002, 09:54 PM
russ russ is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: London, UK
Posts: 129 russ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to russ Send a message via Yahoo to russ
RE: User Log in

okay guys, I got it right this time, I had to number the result var

Reply With Quote
Reply