Jump to content
php.lv forumi

online


homers

Recommended Posts

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 by homers
Link to comment
Share on other sites

$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 by homers
Link to comment
Share on other sites

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());

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...