Jump to content

problem in updating data in to the database +php


menukadevinda

Recommended Posts

hi,

 

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Sahansevena_ver1\admin\profile\updAdmiInfo.php on line 49

 

i got this error.

 

here is the coding

<?php
/* 
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
$dbuser="root";
    $dbpswd="****";
    $dbserver="localhost";


$nwuser=$_POST['username'];
$c_pw=$_POST['cur_password'];
$n_pw=$_POST['conf_password'];
//$user=$userName;
//$pass=$password;
//

$dbname="sahansevena";


if($_SERVER['REQUEST_METHOD']=='POST'){

    //get username and password from admin login.php

$con=mysql_connect($dbserver,$dbuser,$dbpswd);


    if(!$con){
        die('coudnt connect db connection prob'.mysql_error());
    }else{
        if($c_pw==$n_pw){

            $uname=mysql_real_escape_string($username);
            $pword=mysql_real_escape_string($n_pw);
           // setDatabase($dbname, $con) ;
           mysql_select_db($dbname, $con);
            //  $result="update admin set username='$uname',password='$pword'" where limit 0;
            $result="update admin set username='$uname' , password='$pword', last_logged_date =CURDATE(), last_log_time=CURTIME() where username='$uname' limit 0";



            //Checked to see if any rows were returned from the database
            // If rows were returned, set a session variable to 1
            $result=mysql_query($result);



            if ($result) {
                $numRow=mysql_numrows($result);
                if($numRow>0){
                    //session_start();

                   //SESSION['admin']="menuka";

echo "data was suaccesfully updated";
                   /// header ("Location:config/menu.php");

                    //mysql_close($con);
                }else{
                    //session_start();
echo " problem in updating ";
                    //$_SESSION['login'] = "";
                    //header ("Location:login.php");

                }




            }
            else {
                trigger_error(mysql_error(), E_USER_ERROR);
            }




        }

    }

}else{
    echo 'error message not post methode';
    include(login.php);
}




?>



 

please check my code and help me to figur out the error

thx in advance,

menukadevinda

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.