Mikijs Posted March 5, 2008 Report Posted March 5, 2008 (edited) $user_id = Lietotaja ID numurs $text6 = "Iesūtne"; <select name='mbox_id'> <? $mbox=pg_query("SELECT * FROM tblmailboxes WHERE user_id='$user_id'"); while($mbox=pg_fetch_array($mbox)){ print "<option value='".$mbox['mbox_id']."'>".$mbox['mboxname']."</option>"; } if($mbox_id=="INBOX") { $mbox_id=$text6; print "<option value='INBOX' selected>$mbox_id</option>"; } else { print "<option value='INBOX'>$text6</option>"; $sqlinput=pg_query("SELECT * FROM tblmailboxes WHERE user_id='$user_id'"); while($mbox=pg_fetch_array($sqlinput)){ if($mbox['mbox_id']==$mbox_id){$prints=" selected";}else{$prints="";} echo "<option value='".$mbox['mbox_id']."'$prints>".$mbox['mboxname']."</option>"; } } ?> </select> mapē! Problēma ir tā ka vinjs man izdod tikai 2 mapes 1. $text6 (Iesūtne) un 2. Melnraksti bet mbox_id | user_id | mboxname | mbox_type | testit ---------+---------+------------+-----------+------------ 10 | 1 | Melnraksti | 101 | Melnraksti 9 | 1 | IzsÅ«tne | 1 | IzsÅ«tne (2 rows) Edited March 5, 2008 by Mikijs
Aleksejs Posted March 5, 2008 Report Posted March 5, 2008 Problēma ir ka izdod tikai divas mapes un SQL atgriež divus ierakstus? Kur tur ir problēma?
Mikijs Posted March 5, 2008 Author Report Posted March 5, 2008 (edited) iznjemot ara INBOX jeb $text6 izvada 1 ierakstu, jo INBOX ierakstu pats es uzrakstu. if($mbox_id=="INBOX") { $mbox_id=$text6; print "<option value='INBOX' selected>$mbox_id</option>"; } else { print "<option value='INBOX'>$text6</option>"; Edited March 5, 2008 by Mikijs
Aleksejs Posted March 5, 2008 Report Posted March 5, 2008 Ja apskaties "View source", tad vai nav tā, ka ir vairāki OPTION, kam vērtība INBOX?
Mikijs Posted March 5, 2008 Author Report Posted March 5, 2008 <select name='mbox_id'> <option value='10'>Melnraksti</option><option value='INBOX' selected>Iesūtne</option> </select> mapē!
Mikijs Posted March 5, 2008 Author Report Posted March 5, 2008 ew :D es sapratu ;) lol .. :D to4 lol janjem ara no else tas while
Recommended Posts