Neviem si pomoct. Mam nasledovny kod:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<link href="styles/style.css" rel="stylesheet" type="text/css">
<?php
include('sessionheader.php');
include('connectdb.php');
$login=$row['login'];
$sqlx=mysql_query("select * from rp where recipient=$login and visible=1");
$sqly=mysql_query("select * from rp where recipient=$login");
$aktivne=mysql_num_rows("$sqlx");
$spolu=mysql_num_rows("$sqly");
$allkamarati=mysql_query("select * from friends where login=$login");
$data=mysql_fetch_array($allkamarati);
$spocall=mysql_num_rows("$allkamarati");
$onkamarati=mysql_query("select * from chatusers where login=$data[kamarat] and logged=1");
$spocon=mysql_num_rows("$onkamarati");
echo "
</head>
<body bgcolor=#acbeca>
<a href=\"smiles.php\" target=\"_blank\">Smiliky</a>
<a href=\"logout.php?splash=$splash\" target=\"_blank\">Odhlásiť</a>
<a href=\"nastavenia.php?splash=$splash\" target=\"_blank\">Nastavenia</a>
<a href=\"kamarati.php?splash=$splash\" target=\"_blank\">Kamaráti ($spocon/$spocall)</a>
<a href=\"zobrazprofil.php\" target=\"_blank\">Profily</a>
<a href=\"rp.php?splash=$splash\" target=\"_blank\">Správy ($aktivne/$spolu)</a>
</body>
</html>";
?>
Je to textove menu pre prihl. uzivatela, kde zobrazuje kolko mam prihlasenych kamaratov a tak podobne... Lenze ono mi to vzdy vypise idiotske chyby:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/free/yw.sk/s/smilechat/root/www/input2.php on line 11
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/free/yw.sk/s/smilechat/root/www/input2.php on line 12
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/free/yw.sk/s/smilechat/root/www/input2.php on line 15
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/free/yw.sk/s/smilechat/root/www/input2.php on line 16
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/free/yw.sk/s/smilechat/root/www/input2.php on line 18
Smiliky Odhlásiť Nastavenia Kamaráti (/) Profily Správy (/)
Vidite z posledneho riadku tej chyby ze mi to nejako proste nechce pocitat... Ani spravy ani kamaratov. Ale ja mam vsetko spravne, vobec neviem kde moze byt chyba. Prosim pomoc!
int mysql_num_rows ( resource výsledok )
PS.: pocul si uz o select count(*) as pocet from ...? myslim ze to ti v praxi znizi load dost rapidne, dokonca tak jak pred casom pisali na thedailywtf.com, demo fungovalo a produkt nestihal.
$login=$row['login'];
Co to ma za hodnotu .. a bacha na SQL injection :-) celkom pekna vec
$onkamarati=mysql_query("select * from chatusers where login=$data[kamarat] and logged=1");
zadavat
$onkamarati=mysql_query("select * from chatusers where login=".$data['kamarat']." and logged=1");
vyhnes sa niektorym problemom