Blumish Posted November 15, 2011 Report Share Posted November 15, 2011 Sveicināti! Kads ludzu varetu pateikt php scriptu, kas izvelk skaitu, cik raksti ir datubāzē! Paldies Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 15, 2011 Report Share Posted November 15, 2011 Tas būs SQL pieprasījums. SELECT COUNT(`id`) FROM `tāāābūūlāāā` P.S. Tikko pamanīju, ka `tāāābūūlāāā` ir nepareizajās pēdiņās. Pareizi būtu 'tāāābūūlāāā'. Quote Link to comment Share on other sites More sharing options...
nikidijs Posted November 15, 2011 Report Share Posted November 15, 2011 count() Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 15, 2011 Report Share Posted November 15, 2011 Nu nav count()! Quote Link to comment Share on other sites More sharing options...
spainis Posted November 15, 2011 Report Share Posted November 15, 2011 Tas būs SQL pieprasījums. SELECT COUNT(`id`) FROM `tāāābūūlāāā` count(*) Quote Link to comment Share on other sites More sharing options...
sandis_m Posted November 15, 2011 Report Share Posted November 15, 2011 <?php $sql = mysql_query("SELECT COUNT(*) FROM `raksti`"); $res = mysql_result($sql,0,0); echo "Rakstu skaits: ".$res; ?> Quote Link to comment Share on other sites More sharing options...
Blumish Posted November 17, 2011 Author Report Share Posted November 17, 2011 liels paldies sand2s Quote Link to comment Share on other sites More sharing options...
Blumish Posted November 17, 2011 Author Report Share Posted November 17, 2011 <?php $sql = mysql_query("SELECT COUNT(*) FROM `raksti`"); $res = mysql_result($sql,0,0); echo "Rakstu skaits: ".$res; ?> Piemeram, ja man ir shaadi: <?php $sql = mysql_query("SELECT COUNT(*) FROM `ca_caught`"); $res = mysql_result($sql,0,0); echo "Rakstu skaits: ".$res; ?> bet man zem taa ca_caught ir vel triis kategorijas (type 1, 2, 3): Bildes, Video, Raksti. Ka man sho kodu parveidot lai varu izvilkt cik rakstu ir type 1 cik rakstu type 2 un cik rakstu type 3 .. Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 17, 2011 Report Share Posted November 17, 2011 WHERE `type` = `pictures`. P.S. Te man ir kļūda, ja kas. :D 'picture' ir nepareizajās pēdiņās. Quote Link to comment Share on other sites More sharing options...
Blumish Posted November 17, 2011 Author Report Share Posted November 17, 2011 WHERE `type` = `pictures`. un kur shii rindinja kodaa ir jaieliek? Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 17, 2011 Report Share Posted November 17, 2011 SELECT COUNT(*) FROM 'tāāābūūlāāā' WHERE `type` = 'pictures' Kas vēl nav saprotams? Droši jautā. Quote Link to comment Share on other sites More sharing options...
Blumish Posted November 17, 2011 Author Report Share Posted November 17, 2011 tagad man uzmeta shadu erroru: Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\style\classic_view.php on line 91 kopejie rakstu skatijumi: taa rindinja ir: $res = mysql_result($sql,0,0); Quote Link to comment Share on other sites More sharing options...
marcis Posted November 17, 2011 Report Share Posted November 17, 2011 Te drīzāk varētu derēt GROUP BY Quote Link to comment Share on other sites More sharing options...
daGrevis Posted November 17, 2011 Report Share Posted November 17, 2011 Te drīzāk varētu derēt GROUP BY Kāpēc? Kas vainas WHERE klauzam?! Quote Link to comment Share on other sites More sharing options...
Blumish Posted November 17, 2011 Author Report Share Posted November 17, 2011 bet ari tas where neiet Quote Link to comment Share on other sites More sharing options...
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.