homers Posted September 26, 2009 Report Share Posted September 26, 2009 (edited) Tatad gribu uztaisīt online lietotāju sarakstu rekur kods: <?php $con = mysql_connect("localhost","root","parole"); mysql_select_db("aa", $con); if (!$con) { die('errors: ' . mysql_error()); } $on = "Y"; $sql = mysql_query("SELECT COUNT(*) FROM lietotaji WHERE online=$on"); $online = $sql[0]; ?> Edited September 26, 2009 by homers Quote Link to comment Share on other sites More sharing options...
waplet Posted September 26, 2009 Report Share Posted September 26, 2009 nu vajag fetch'ot vispirms Quote Link to comment Share on other sites More sharing options...
Trac3 !! Posted September 26, 2009 Report Share Posted September 26, 2009 kapec tev tur ir count, ja tu gribi šo cilvēku sarakstu? un jā + waplet posts :) Quote Link to comment Share on other sites More sharing options...
homers Posted September 26, 2009 Author Report Share Posted September 26, 2009 (edited) $sql = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM lietotaji WHERE online=$on")); Šadi? Tad rada: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\rise\index.php on line 212 Es gribu izvilkt lietotāju skaitu cik online Edited September 26, 2009 by homers Quote Link to comment Share on other sites More sharing options...
Trac3 !! Posted September 26, 2009 Report Share Posted September 26, 2009 (edited) mysql_num_rows("select * from lietotaaji where online=$on") vai mysql_fetch_array(mysql_query("select count(*) from lietotaaji where online=$on")); Edited September 26, 2009 by Trac3 !! Quote Link to comment Share on other sites More sharing options...
homers Posted September 26, 2009 Author Report Share Posted September 26, 2009 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\rise\index.php on line 212 Quote Link to comment Share on other sites More sharing options...
Trac3 !! Posted September 26, 2009 Report Share Posted September 26, 2009 1. pamegini pirmo ko rakstiju ar mysql_num_rows 2. nekope to ko rakstu, jo man ir cits tabulas nosaukums.. 3. mekle kludu pats.. Quote Link to comment Share on other sites More sharing options...
marcis Posted September 26, 2009 Report Share Posted September 26, 2009 mysql_num_rows() nav paredzēts, lai iegūtu ierakstu skaitu, tam ir paredzēta MySQL COUNT() funkcija. mysql_num_rows() parāda atlasīto ierakstu skaitu, bet šajā gadījumā ieraksti nav atlasīti. Kļūdas meklējam šādi: mysql_query(...)or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted September 27, 2009 Report Share Posted September 27, 2009 (edited) "SELECT COUNT(*) FROM lietotaji WHERE online='$on'" Edited September 27, 2009 by xPtv45z 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.