daGrevis Posted January 31, 2014 Report Posted January 31, 2014 > SELECT COUNT(*) FROM `users`; Quote
Gochix Posted January 31, 2014 Author Report Posted January 31, 2014 > SELECT COUNT(*) FROM `users`; jā bet man vajag lai katrā tabulas info piemēram būtu 1 Name , Data of birth utt 2 name , data of birth utt nevis lai visu laiku vinjsh skaititu vienadus.. Quote
metal-0-1 Posted January 31, 2014 Report Posted January 31, 2014 Liecies mierā cilvēk, tev tikai liekas, ka tev tas ir vajadzīgs. Un nevienam citam tas arī nekad nebūs vajadzīgs. Izej ārā, ieelpo svaigu gaisu. Ejiet visi mājās, nav vērts. Izslēdzam gaismu, aizveram aiz sevis topiku un viss. Ejiet visi mājās. Quote
Gochix Posted January 31, 2014 Author Report Posted January 31, 2014 Liecies mierā cilvēk, tev tikai liekas, ka tev tas ir vajadzīgs. Un nevienam citam tas arī nekad nebūs vajadzīgs. Izej ārā, ieelpo svaigu gaisu. Ejiet visi mājās, nav vērts. Izslēdzam gaismu, aizveram aiz sevis topiku un viss. Ejiet visi mājās. aizej pie aarsta Quote
codez Posted January 31, 2014 Report Posted January 31, 2014 (edited) Ko darīt, ja viņš pats ir ārsts? Rekursija vai bezgalīgais cikls? Edited January 31, 2014 by codez Quote
Gochix Posted January 31, 2014 Author Report Posted January 31, 2014 Ko darīt, ja viņš pats ir ārsts? Rekursija vai bezgalīgais cikls? bezgaligais cikls.. a teemu, vai ir tada iespeja kaa iznemt no db takaa row number tjip ieliekot info db paradas number un tad pec katas attiecigi pieskirt number 1,2,3 utt? Quote
codez Posted January 31, 2014 Report Posted January 31, 2014 http://codepad.org/Z26PMQZ2 for($i=1; $i<=100; $i++){ echo $i."\n"; } Quote
ieleja Posted January 31, 2014 Report Posted January 31, 2014 un kā tev, @codez, izdodas saprast "ko viņi īstenībā vēlas"? kaa iznemt no db takaa row number tjip ieliekot info db paradas number un tad pec katas attiecigi pieskirt number 1,2,3 utt iz pilnīgi sasvīdu, domādams ko nozīmē tie "number ... number ... number 1,2,3 utt" Quote
Gochix Posted January 31, 2014 Author Report Posted January 31, 2014 http://codepad.org/Z26PMQZ2 for($i=1; $i<=100; $i++){ echo $i."\n"; } echo "<tr><td align=center width=30><font color=white>" . $i ."</td></font> rada tik 101 visiem, kur isti un kaa pareizi jauzliek Quote
codez Posted January 31, 2014 Report Posted January 31, 2014 Ja ieliktu vairāk no tā koda, varētu vairāk palīdzēt. http://codepad.org/papS3GIh Quote
daGrevis Posted January 31, 2014 Report Posted January 31, 2014 Re kur ar rekursiju11!!:O http://codepad.org/NBgU5cbn Quote
e-remit Posted January 31, 2014 Report Posted January 31, 2014 Nu, to varēja arī ar SQL: SET @n=0; SELECT @n:=@n+1 AS `num`, `name` FROM users; Quote
Gochix Posted February 1, 2014 Author Report Posted February 1, 2014 (edited) Ja ieliktu vairāk no tā koda, varētu vairāk palīdzēt. <?php $connection = mysql_connect('localhost', 'root', 'pass'); //The Blank string is the password mysql_select_db('db'); $query = "SELECT * FROM status ORDER BY name ASC"; //You don't need a ; like you do in SQL $result = mysql_query($query); echo "<table align=center borderColor=#282617 width=500 border=1 cellPadding=0 cellspacing=0>"; // start a table tag in the HTML while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results echo "<tr><td align=center width=30><font color=white>" . šeit vajag būt tam $i bet nestrādā ."</td></font><td align=center width=80><font color=white>" . $row['char_name'] ."</td></font><td align=center width=70><font color=white>" . $row['char_class'] . "</td></font><td align=center width=120><font color=white>" . $row['char_guild'] . "</td></font><td align=center width=40><font color=white>" . $row['char_level'] . "</td></font><td align=center width=60><font color=white>" . $row['char_gametime'] . "</td></font><td align=center width=95><font color=white>" . $row['char_profaccount'] . "</td></font></tr>"; //$row['index'] the index here is a field name } echo "</table>"; //Close the table in HTML mysql_close(); //Make sure to close out the database connection ?> tur parādīts kur vajag to $i ielikt.. ok ieliku šādi while($row = mysql_fetch_array($result)) for($i=1; $i<=10; $i++){ //Creates a loop to loop through results echo "<tr><td align=center width=30><font color=white>" . $i ."</td></font><td align=center width=80><font color=white>" . $row['char_name'] ."</td></font><td align=center width=70><font color=white>" . $row['char_class'] . "</td></font><td align=center width=120><font color=white>" . $row['char_guild'] . "</td></font><td align=center width=40><font color=white>" . $row['char_level'] . "</td></font><td align=center width=60><font color=white>" . $row['char_gametime'] . "</td></font><td align=center width=95><font color=white>" . $row['char_profaccount'] . "</td></font></tr>"; //$row['index'] the index here is a field name } Tad strādā, bet tikai problēma tāda, man ir db 1 ieraksts, un tad nu viņš ņem tagad to 1 ierakstu un attēlo 100 reizes.. līdz skaitlim 100.. Edited February 1, 2014 by Gochix Quote
Gochix Posted February 1, 2014 Author Report Posted February 1, 2014 (edited) Paldies, bet nu pachakareejos domaajot un beigaas sanaaca shaadi.. for( $i= 0 ; $i <= 0 ; $i++ ){ } while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results echo "<tr><td align=center width=30><font color=white>" . $i++ ."</td></font> Var vērt ciet.. Edited February 1, 2014 by Gochix Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.