Pogledajte određenu poruku
Staro 14. 11. 2010.   #1
slavkan
profesionalac
Professional
 
Datum učlanjenja: 30.08.2010
Poruke: 201
Hvala: 10
640 "Hvala" u 14 poruka
slavkan is on a distinguished roadslavkan is on a distinguished roadslavkan is on a distinguished roadslavkan is on a distinguished roadslavkan is on a distinguished roadslavkan is on a distinguished road
Default mysql_num_rows(): supplied argument

Hoce mi neko reci koji je k**** ovoj funkciji i da li jos neko ima problema sa njom ili sam samo ja osudjen na ovo. Pazite ovo, pravio sam neku ajax scriptu i ona radi ali pored toga sto se izvrsi vrati mi i gresku za ovu funklciju

Kôd:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
Znaci indeticno kao i u prethodnom mom pisanju i onoj skripti za logovanje. Evo kompletnog koda:

index.html
Kôd:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration form</title>
<script type="text/javascript"> 
<!--
var minlength = '3';
var delay = '1000';
var divid = 'username_exists';
function timeoutUsernameCheck(){
if(window.mytimeout) window.clearTimeout(window.mytimeout);
window.mytimeout = window.setTimeout("toggle_username()", delay);
return true;
}
function toggle_username() { 
          if (window.XMLHttpRequest) { 
        http = new XMLHttpRequest(); 
    } else if (window.ActiveXObject) { 
        http = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    handle = document.getElementById('username'); 
    var url = 'check.php?'; 
    if(handle.value.length > minlength) { 

                // Timestamp for preventing IE caching the GET request   
                fetch_unix_timestamp = function()   
                {   
                return parseInt(new Date().getTime().toString().substring(0, 10))   
                }   
                var timestamp = fetch_unix_timestamp(); 
        var fullurl = url + 'do=check_username_exists&username=' + encodeURIComponent(handle.value) + '&timestamp=' + timestamp; 
        http.open("GET", fullurl, true); 
        http.send(null); 
        http.onreadystatechange = statechange_username; 
    }else{ 
        document.getElementById(divid).innerHTML = ''; 
    }
} 
function statechange_username() { 

    if (http.readyState == 4) { 

        var html = http.responseText;
        document.getElementById(divid).innerHTML = html; 
            } 
} 
//-->
</script> 
</head>
<body>
<p style="font-weight: bold;">Ajax provera korisnickog imena</p>
<br />
Rezultat poznat nakon<span style="font-weight: bold; color: green;"> 1 sekunde</span>; minimalan broj karaktera<span style="font-weight: bold; color: green;"> 4</span>.</p>
<div id="wrapper">
<div id="left" style="float: left; margin-right: 8px;">
<label for="username" style="margin-right: 6px;">Korisnicko ime: </label><input id="username" type="text" name="username" onkeyup="timeoutUsernameCheck()" size="20" style="display: inline;"/><br>
<label for="username" style="margin-right: 6px;">E-mail: </label><input id="username" type="text" name="email" onkeyup="timeoutUsernameCheck()" size="20" style="display: inline;"/><br>
<label for="username" style="margin-right: 6px;">Lozinka: </label><input id="username" type="text" name="sifra" onkeyup="timeoutUsernameCheck()" size="20" style="display: inline;"/>
</div>
<div id="username_exists" style="display: inline; font-size: 11px; font-weight: bold; color:#FF3300"> </div> 
</div>
</body>
</html>
Evo check.php

Kôd:
<?php
// Connect to MySQL DB

mysql_connect ('localhost', 'root', '');
mysql_select_db('diplbaza');

$do = $_GET['do'];
switch($do) 
{
case 'check_username_exists':
if(!get_magic_quotes_gpc()) 
{
$username = addslashes($_GET['username']);
}
else
{
$username = $_GET['username'];
}
$count = mysql_num_rows(mysql_query("SELECT * FROM check WHERE korime= '$username' "));
if($count > 0) 
{

// Ako je korisnicko ime slobodno
echo '<img src="cross.jpg" alt="" width="22" height="22" />';
}
else
{

// Ako korisnicko ime nije dostupno

echo '<img src="check.jpg" alt="" width="22" height="22" />';

}
break;
default:
echo 'No action specified.';
break;
}
?>
Za ovaj put sam dobro proverio podatke u bazi, znaci ova tabela sigurno postoji i duzina polja su ok)
Probao sam i razne kombinacije sa ovim navodnicima isto kao i u prethodnom skriptu i nece pa nece. Da li postoji nacin da se ovo resi?Da li mozda u php.ini treba da podesim neke stvari vezane za ovu funkciju?
slavkan je offline   Odgovorite uz citat