SunQuest
           Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

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:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old March 7th, 2004, 09:33 PM
SnowStorm SnowStorm is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 374 SnowStorm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Sessions tutorial again

hey im trying to use the sessions tutorial, everything works but when it is suppose to return the id it returns an array instead.. here is my login function code:
php Code:
Original - php Code
  1.  
  2. function login ($forms)
  3. {
  4.   $username = $forms["username"];
  5.   $password = $forms["password"];
  6.   $sql = "SELECT ID FROM click_login WHERE Username='$username' AND Password='$password'";
  7.   $result = mysql_query($sql) or die(mysql_error());
  8.   $id = mysql_fetch_assoc($result);
  9.   return $id;
  10. }


And then login.php code
php Code:
Original - php Code
  1.  
  2. include ("functions.php");
  3. if($_POST)
  4. {
  5.   $error = login_check($_POST);
  6.   if (trim($error)=="1")
  7.   {
  8.     $_SESSION["id"] = login($_POST);
  9.     Header("Location: ./index.php"); // Redirect correct member
  10.     exit();
  11.   }
  12.   else
  13.   {
  14.     print "Error:$error";
  15.   }
  16. }
  17.  
  18. print("<form method="post" action="{$_SERVER['PHP_SELF']}">
  19. Username : <input type="text" name="username"><br>
  20. Password : <input type="password" name="password"><br>
  21. <input type="submit" value="Login">
  22. </form>");


Edit: oh wow lol i think i just figured it out.. fetching it into an array i would have to return $id['id'] right?

Reply With Quote
  #2  
Old March 7th, 2004, 10:45 PM
sliver's Avatar
sliver sliver is offline
Moderator
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: WI, USA
Posts: 888 sliver User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 17 m 29 sec
Reputation Power: 2
Send a message via AIM to sliver Send a message via XFire to sliver
RE: Sessions tutorial again

Yes, you are right lol.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Sessions tutorial again


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway