autly Posted December 24, 2008 Report Share Posted December 24, 2008 $sql = ("SELECT * FROM teams WHERE league_id='".$_GET['id']."' AND league_status='join'"); $result = @mysql_query($sql) or die(mysql_error()); echo "<br />Pieteikumus iesniegushas<br />"; $i=0; while($row = mysql_fetch_array($result)) echo "<br />".++$i.". ".$row["name"].""; Pienemsim ka man datubaazee ir 30 komandu nosaukumi( neviens no tiem neatkaartojas ). Man vajag kka tos visus definaat piem: $team_1_, $team_2_ utt. Vai tas ir iespeejaams? Link to comment Share on other sites More sharing options...
waplet Posted December 24, 2008 Report Share Posted December 24, 2008 varēty ar ciklu un variablis ir $team = $team_$i++ , vai kktā Link to comment Share on other sites More sharing options...
autly Posted December 24, 2008 Author Report Share Posted December 24, 2008 $team_id_".++$i." = $row["name"]; domaa taa? Link to comment Share on other sites More sharing options...
waplet Posted December 24, 2008 Report Share Posted December 24, 2008 (edited) Jap , tieši tā pamēģini , bet vajag ciklu izveidot lai atkartojas un lai pie nakama row izvades 1 pieskaitās! ķipa while () Edited December 24, 2008 by waplet Link to comment Share on other sites More sharing options...
p4F Posted December 25, 2008 Report Share Posted December 25, 2008 $team = array(); while(....){ $team[] = $row['name'] } Link to comment Share on other sites More sharing options...
marcis Posted December 25, 2008 Report Share Posted December 25, 2008 Lieto masīvus, pēc tam pašam būs vieglāk strādāt. Bet principā, ja šādi grib darīt, tad $var="team_".++$i; echo $var; // vai, ja $team_1 jau ir mainīgais echo ${$team."_".++$i}; Link to comment Share on other sites More sharing options...
Recommended Posts