Jump to content
php.lv forumi

mysql_num_rows kluda !


ayzyyy

Recommended Posts

Labdien ! Es meiginu uzlikt skriptu un izmet kludu .

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in/home/headz/public_html/inc/login.php on line 28

 

Ko tas nozime ?

28.rinda : if(mysql_num_rows($sql)>0){

Ko jalabo pasakit ludzu

Link to comment
Share on other sites

parādi pilnu kodu

Nem apskaties kodu paskaties un pasaki kas par vainu !

<?php
mysql_connect("localhost", "sql_user", "pw");
mysql_select_db("db_name");
function login(){
echo '
<form method="post" action="f/index.php?act=Login&CODE=01&return=http://headz.woano.lv">
 <table>
  <td>
<input name="UserName" value="Lietotajs" type="text" />
<input name="PassWord" value="Parole"type="password" />
<input value="Ienakt" border="0" type="submit" />
  </td>
       	<input name="CookieDate" value="1" type="hidden" />
 </table>
</form>
';
}
if ($_COOKIE['member_id'] == true) {
 $cid = (int)$_COOKIE['member_id'];
 $mlc = mysql_real_escape_string($_COOKIE['pass_hash']);
 $sql = mysql_query("SELECT * FROM `ibf_members` WHERE `id` = '$cid' AND member_login_key='$mlc' LIMIT 1");
 if(mysql_num_rows($sql)>0){
  $row = mysql_fetch_object($sql);
  $idf = $row->id;
  $results = mysql_query("SELECT * FROM ibf_member_extra WHERE `id` = '".$idf."' ");
  $ros = mysql_fetch_object($results);
  $key = md5($row->email.'&'.$row->member_login_key.'&'.$row->joined);
  $points = $row->points;
  switch($ros->avatar_type){
case 'url':
	$avatars = $ros->avatar_location;
break;

case 'local':
	$avatars = "/img/no_avatar.gif";
break;

case 'upload':
	$avatars = "f/uploads/".$ros->avatar_location;
break;
  }
echo'
	<center>Sveiks ,'.$row->members_display_name.' !</center> <br />

	<center><img src="'.$avatars.'" alt="Avatar" title="'.$row->members_display_name.' Avatrs" /></center>

	<ul>
 	<center><li><a href="#">Labot profilu</a></li>
 	<li><a href="#">Jaunākie ieraksti</a></li>
 	<li><a href="#">Vēstules <span style="color: red;" > ('.$row->new_msg.')</span></a></li>
 	<li><a href="f/index.php?act=Login&CODE=03&k='.$key.'">Izlogoties</a></li>
 	</center>
	</ul>
';
 }else{
  login();
 }
}else{
 login();
}
?>

Link to comment
Share on other sites

Vai vēl gudrāk būtu... tur kur izpildi kveriju:

 

mysql_query('...');

 

Šitā:

 

mysql_query('...') || mysql_error();

 

Tas dos detalizētāku kļudas aprakstu un tā. :)

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...