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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

  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.

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