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:
  #1  
Old October 7th, 2002, 07:11 AM
mrq mrq is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 37 mrq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
problem between session and while loop!!

Oki the problem is that when i make a session inside while loop then it only passes 1 variable thought there is a 4 variables!
The code is abowe!
php Code:
Original - php Code
  1.  
  2. if(isset($submit)){
  3.     if(isset($_POST)){
  4.         while(list($kys,$vast)=each($_POST)){
  5.             if(is_numeric($kys) AND is_numeric($vast)){
  6.                 if(!empty($kys) AND !empty($vast)){
  7.                     echo 'Kysimus '.$kys.' vastus '.$vast.'<br>';
  8.                     require_once("sessioon.php");
  9.                     require_once("mysql.php");
  10.                     $vaatame="SELECT id FROM kasutaja_vastused WHERE kysimus_id=$kys AND kasutaja_id='$_SESSION[klient_id]'";
  11.                     $jalgime=mysql_query($vaatame);
  12.                     $loendus=mysql_num_rows($jalgime);
  13.                     if($loendus=="0"){
  14.                         $kontroll=mysql_query("INSERT INTO kasutaja_vastused (id,kasutaja_id,keele_id,quiz_id,kysimus_id,vastus  _id,aeg)
  15.                         "."values('',$_SESSION[klient_id],'$_SESSION[keel]','$_SESSION[quiz]','$kys','$vast',now())");
  16.                         if($kontroll){
  17.                             if(isset($_SESSION['mitu'])){
  18.                                 $mitmes=$_SESSION['mitu']+1;
  19.                                 if($mitmes>=mitu_kokku()){
  20.                                     header("Location:form.php");
  21.                                 }
  22.                             }
  23.                         }else{
  24.                             mail("mrq@themail.com", "Viga quizi insert lausega", "Viga: " .mysql_error(), "From: index.php@quiz.vm");
  25.                         }
  26.                     }else{
  27.                         if(isset($_SESSION['mitu'])){
  28.                             $mitmes=$_SESSION['mitu']+1;
  29.                             if($mitmes>=mitu_kokku()){
  30.                                 header("Location:form.php");
  31.                             }
  32.                         }
  33.                         echo"Allready answerd";
  34.                     }
  35.                 }
  36.             }
  37.         }
  38.     }
  39.     $_SESSION['mitu']++;//lets move on with the question, needed in quiz function
  40. }

Reply With Quote
  #2  
Old October 7th, 2002, 07:14 AM
mrq mrq is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 37 mrq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: problem between session and while loop!!

If i comment out the session then it works fine and outputs all the variables...
Why it does'nt the while work after session is started??

Reply With Quote
  #3  
Old October 7th, 2002, 10:58 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: problem between session and while loop!!

I don't know what is going on here : require_once("sessioon.php");, but you might try placing that outside the loop. There might be something in that file that is overwriting the session...

Reply With Quote
  #4  
Old October 7th, 2002, 11:12 AM
mrq mrq is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 37 mrq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: problem between session and while loop!!

Oki thx...i thought that makeing the $_POST global doesnt affect this form...but it did. In the sessioon.php i used the loops to make $_GET, $_POST variables as global... my fault but thx it works great now.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > problem between session and while loop!!


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 | 
  
 





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