am also getting this error ? Any help would greatly be appreciated.

Thanks

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\Hebahan\selenggaraPengguna.php on line 67

<?php 
Header("Cache-Control: must-revalidate");
$offset = 60 * 60 * 24 * 3;
$ExpireString = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
Header($ExpireString);

session_start(); 
if ($_SESSION['nokp'] == NULL) 
{ 
die("Sila log masuk menggunakan skrin utama !!"); 
} 
$idStaf=strtoupper($_SESSION['nokp']); 
include("./headerDaerah.php");
require 'dbConnect.php';

$carian = $_POST['carian'];
$ic = $_POST['ic'];
$nama = $_POST['nama'];

?>
<head>
<title>Sistem E-Hebahan</title>
<link rel="stylesheet" href="file:///C|/xampp/htdocs/Hebahan/css/table.css" type="text/css" />
<style type="text/css">
<!--
.style38 {color: #000000}
.style43 {font-size: 12px; font-weight: bold; font-family: tahoma, verdana; }
-->
</style>
</head>
<body>
<?php

if($carian == "All") {

$sql="SELECT * FROM pendaftaran";
$result=mysql_query($sql);

} else if ($carian == "namaSuspek") {

$sql="SELECT * FROM pendaftaran where nama like '%$nama%'";
$result=mysql_query($sql);

} else if ($carian == "KadPengenalan") {

$sql="SELECT * FROM pendaftaran where nokp like '%$ic%'";
$result=mysql_query($sql);

}
?>
<form name="form1" method="post" action="">
<table width="800" height ="33" border="0" align="center" bordercolor="#7D9BE3" bgcolor="#7D9BE3">
  <tr>
    <th bgcolor="#7D9BE3" scope="row"><span class='tbl_title style38'>SELENGGARA SUSPEK </span></th>
  </tr>
</table>

  <table width="800" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr bordercolor="#B6CDFB" bgcolor='#B6CDFB' class="tbl_title">
      <td width="37" height="25" align="center"><span class="style43">BIL</span></td>
      <td width="189" align="center"><span class="style43">NAMA</span></td>
      <td width="173" align="center" bordercolor="#B6CDFB" bgcolor="#B6CDFB"><span class="style43">NAMA GELARAN</span></td>
      <td width="137" align="center"><span class="style43">NO IC </span></td>
      <td width="99" align="center"><span class="style43">NO REPOT </span></td>
      <td colspan="4" align="center"><span class="style43">TINDAKAN</span></td>
    </tr>
    <?php
$i=1;
while($rows=mysql_fetch_array($result)){  ------> line 67

$namaSuspek = $rows['nama'];
$nokp=$rows['nokp'];
$nokp1= trim ($nokp);
?>
    <tr class="tbl_kurCon" bordercolor="#FFFFF2" bgcolor="#FFFFF2">
      <td>
      <div align="center"> <? echo "$i"; ?></div></td>
      <td bordercolor="#FFFFF2" bgcolor="#FFFFF2">
      <div align="justify"> <? echo $rows['nama'];?> </div></td>
      <td>
      <div align="center"><? echo $rows['nama_gelaran']; ?> </div></td>
      <td>
      <div align="center"><? echo $rows['nokp']; ?></div></td>
      <td>
      <div align="center"><? echo $rows['repot_no']; ?></div></td>
      <td width="129" align="center"><a href="selenggaraSuspek_11.php?&task=update&nokp=<?=$nokp1?>"><img src="img/edit7.bmp" border="0"></a> &nbsp;&nbsp;&nbsp;<a href="deleteSuspek.php?&task=delete&nokp=<?=$nokp1?>" onClick="return confirm('Adakah anda pasti?');" ><img src="img/delete1.bmp" border="0"></a></td>
      <? $i++;?>
      <? } ?>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</form>
<p>&nbsp;</p>
<?php
mysql_close();
?>
</body>
</html>

try this....modify other sql statements similarly..

$sql = "SELECT * FROM pendaftaran WHERE nokp like  '%".$_POST[ic]."%'";

thanks a lot.

im getting this error ? Any help would greatly be appreciated.
The problem is after i filled in the user registration form then save it, the error will come outlike this :-
Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\Hebahan\pendaftaranPengguna.php on line 49

<?php 
session_start(); 
if ($_SESSION['nokp'] == NULL) 
{ 
die("Sila log masuk menggunakan skrin utama !!"); 
} 
$idStaf=strtoupper($_SESSION['nokp']); 
$nama=strtoupper($_SESSION['nama']); 
include("./headerDaerah.php");

?>
<SCRIPT TYPE="text/javascript">
// Validate user registration info 
function checkFormDaftar( form )
{
  if (form.idname.value == "" || form.uname.value == "" || form.passwd.value == "" || form.email.value == "") {
    alert( "Semua maklumat mestilah diisi. Sila masukkan mana-mana yang belum diisi." );
    form.idname.focus();
    return false ;
  } 
  return true ;
}
</SCRIPT>
<?
if (isset($_POST['submit'])) { // if form has been submitted
    /* check they filled in what they supposed to, 
    passwords matched, username
    isn't already taken, etc. */

    //echo $_POST['daerah']."<br>";

    //echo $kod_negeri=substr($_POST['daerah'],0,2)."<br>";
    //echo $kod_daerah=substr($_POST['daerah'],-2,2);   


    if (!$_POST['idname'] | !$_POST['uname'] | !$_POST['passwd'] | !$_POST['passwd_again']) {
        alert( "Semua maklumat mestilah diisi. Sila masukkan mana-mana yang belum diisi." );
        form.idname.focus();
    }

    // check if username exists in database.

    if (!get_magic_quotes_gpc()) {
        $_POST['idname'] = addslashes($_POST['idname']);
    }



$name_check = $db_object->query("SELECT nokp FROM pengguna WHERE nokp = '".$_POST['idname']."'"); ------>line 49

    if (DB::isError($name_check)) {
        die($name_check->getMessage());
    }

    $name_checkk = $name_check->numRows();

    if ($name_checkk != 0) {
    ?>
<table width='800' height='100' border='0' bordercolor='<?=$tblborder_color?>' cellpadding='0' cellspacing='0' align='center' bgcolor='#FBFBF4'>
     <TR height='33' valign='center'>
        <TD style='border-width:0px' colspan='2' class='tbl_title' bgcolor="<?=$tblheader_color?>" align='center'><span style="color: #000000; font-family: tahoma, verdana; font-size: 12px;"><B>DAFTAR PENGGUNA</B></span></TD>
    </TR>
    <TR>
        <TD colspan='2' bgcolor="#FFFFF2" style='border-width:0px'><CENTER><BR><BR><BR>
        <U><span style="font-family: tahoma, verdana; font-size: 12px;">PEMAKLUMAN RALAT</span></U><span style="font-family: tahoma, verdana; font-size: 12px;"><BR>
        <BR>
        <BR>
        Rekod pengguna ini telah wujud!</span><span style="font-family: tahoma, verdana"><BR>
        </span><BR>
      <input type=button value="Kembali" onClick="history.go(-1)"></CENTER><BR><BR><BR><BR></TD>
  </TR>
</table>
    <?php
    } else {

    // check passwords match

    if ($_POST['passwd'] != $_POST['passwd_again']) {
        die('Passwords did not match.');
    }

    // check e-mail format

//  if (!preg_match("/.*@.*..*/", $_POST['email']) | preg_match("/(<|>)/", $_POST['email'])) {
//      die('Invalid e-mail address.');
//  }

    // no HTML tags in username, website, location, password

    $_POST['idname'] = strip_tags($_POST['idname']);
    $_POST['uname'] = strip_tags($_POST['uname']);
    $_POST['passwd'] = strip_tags($_POST['passwd']);

    // check show_email data

    /* the rest of the information is optional, the only thing we need to 
    check is if they submitted a website, 
    and if so, check the format is ok. */

    // now we can add them to the database.
    // encrypt password

    $_POST['passwd'] = md5($_POST['passwd']);

    if (!get_magic_quotes_gpc()) {
        $_POST['uname'] = addslashes($_POST['uname']);
        $_POST['passwd'] = addslashes($_POST['passwd']);
        $_POST['email'] = addslashes($_POST['email']);
    }

    $regdate = date('Y-m-d');

    $kod_negeri=substr($_POST['daerah'],0,2);
    $kod_daerah=substr($_POST['daerah'],-2,2);

    $insert = "INSERT INTO pengguna (
            nokp, 
            nama, 
            katalaluan, 
            tkhDaftar, 
            emel,
            gred,
            kod_paras,
            kod_daerah,
            kod_negeri) 
            VALUES (
            '".$_POST['idname']."', 
            '".$_POST['uname']."', 
            '".$_POST['passwd']."', 
            '$regdate', 
            '".$_POST['email']."','1',
            '".$_POST['gred']."', 
            '$kod_daerah',
            '$kod_negeri')";

    $add_member = $db_object->query($insert);

    if (DB::isError($add_member)) {
        die($add_member->getMessage());
    }

    $db_object->disconnect();
    ?>
<table width='800' height='100' border='0' bordercolor='<?=$tblborder_color?>' cellpadding='0' cellspacing='0' align='center' bgcolor='#FBFBF4'>
     <TR height='33' valign='center'>
        <TD style='border-width:0px' colspan='2' class='tbl_title' bgcolor="<?=$tblheader_color?>" align='center'><span style="color: #000000; font-family: tahoma, verdana; font-size: 12px;"><B>DAFTAR PENGGUNA</B></span></TD>
    </TR>
    <TR>
        <TD colspan='2' bgcolor="#FFFFF2" style='border-width:0px'><CENTER><BR><BR>
            <span style="font-family: tahoma, verdana; font-size: 12px;"><BR>
            <U>PENGESAHAN</U><BR>
            <BR>
            <BR>
        Rekod pengguna telah disimpan.<BR>
            </span><BR>
      <input type=button value="Kembali" onClick="history.go(-1)"></CENTER><BR><BR>
      <BR><BR></TD>
  </TR>
</table>
<?php }
} else {    // if form hasn't been submitted
?>
<tr valign="top">
    <td width="800">
    <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" name="formDaftar" method="post"  onsubmit="return checkFormDaftar(this);">
    <table width='800' height='299' border='0' bordercolor='<?=$tblborder_color?>' cellpadding='0' cellspacing='0' align='center' bgcolor='#FFFFF2'>
    <TR valign='center' bgcolor="<?=$tblheader_color?>" height='33'>
        <TD height="19" colspan='2' align='center' class='tbl_title' style='border-width:0px'><span style="color: #000000"><B>DAFTAR PENGGUNA</B></span></TD>
    </TR>
    <TR height='25'>
        <TD style='border-width:0px' width='250' align=right>&nbsp;</TD>
        <TD style='border-width:0px' align=left class="MandMsg">Medan bertanda asteriks (*) hendaklah diisi.</TD>
    </TR>
    <TR>
        <TD style='border-width:0px' align=right class="tbl_kurCon">No. Kad Pengenalan * :&nbsp;</TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon"><input type="text" name="idname" maxlength="14"> 
          <span style="font-style: italic; font-size: 11px; color: #FF0000;">cth : 000000-00-0000</span></TD>
    </TR>
    <TR>
        <TD style='border-width:0px' align=right class="tbl_kurCon">Nama Pegawai/Kakitangan * :&nbsp;</TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon"><input type="text" name="uname" maxlength="80" size ="50"></TD>
    </TR>
    <TR>
        <TD style='border-width:0px' align=right class="tbl_kurCon">Katalaluan * :&nbsp;</TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon"><input type="password" name="passwd" value='12345' maxlength="50"></TD>
    </TR>
    <TR>
        <TD style='border-width:0px' align=right class="tbl_kurCon">Pengesahan Katalaluan * :&nbsp;</TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon"><input type="password" name="passwd_again" value='12345' maxlength="50"></TD>
    </TR>
    <TR>
      <TD style='border-width:0px' align=right class="tbl_kurCon">E-Mel * :&nbsp;</TD>
      <TD style='border-width:0px' align=left class="tbl_kurCon"><input type="text" name="email" maxlength="100" size= "50"></TD>
      </TR>
    <TR>
        <TD style='border-width:0px' align=right class="tbl_kurCon">Gred * :&nbsp;</TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon"><input type="text" name="gred" maxlength="100" size= "25"></TD>
    </TR>
    <TR>
        <TD height="29" align=right class="tbl_kurCon" style='border-width:0px'>Paras Pengguna  * :&nbsp;</TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon">
            <?php
            $query04 = "SELECT * FROM aadk_daerah ORDER BY keterangan"; 
            $result04 = mysql_query($query04) or die(mysql_error());
            ?>
            <select name="daerah">
              <?php  
                while($nt04=mysql_fetch_array($result04)) {
                    if ($nt04['kod_daerah'] <> "0"){
                        if ($nt04['kod_daerah'] == "1") { ?>
              <option selected="yes" value="<?=$nt04['kod_negeri'].$nt04['kod_daerah']?>">
              <?=$nt04["keterangan"] ?>
              </option>
              <?
                        } else { ?>
              <option value="<?=$nt04['kod_negeri'].$nt04['kod_daerah']?>">
              <?=$nt04["keterangan"] ?>
              </option>
              <?
                }   }   } ?>
            </select>
        </TD>
    </TR>
    <TR height='5' valign='center'>
        <TD style='border-width:0px' colspan='2'>&nbsp;</TD>
    </TR>
    <TR>
        <TD style='border-width:0px'></TD>
        <TD style='border-width:0px' align=left class="tbl_kurCon">
        <INPUT TYPE="submit" name="submit" Value="::: Daftar :::"></TD>
    </TR>
    <TR height='20' valign='center'>
        <TD style='border-width:0px' colspan='2'>&nbsp;</TD>
    </TR>
    </TABLE>
    </FORM>

    </td>
</tr>
<?

}
?>

change this for line 49

$name_check = mysql_query("SELECT nokp FROM pengguna WHERE nokp = '".$_POST['idname']."'") or die(mysql_error());

Im already edit using that code but still get error ;
Fatal error: Class 'DB' not found in C:\xampp\htdocs\Hebahan\pendaftaranPengguna.php on line 48.

<?php
//including the database connection file
include_once("config.php");

if(isset($_POST['update']))
{
    //here the id that we post is the same id that we get from url
    //id indicates the id of this data which we are editing
    //id is unique and a particular id is associated with particular data   
    $userid = $_POST['userid'];

    $name=$_POST['name'];
    $password=$_POST['pass'];
    $confirmpassword=$_POST['confirmpass'];
    $photo=$_POST['photo'];
    $year=$_POST['year'];
    $std=$_POST['standard'];
    $section=$_POST['sec'];
    $rollno=$_POST['roll'];
    $address=$_POST['addr'];
    $city=$_POST['city'];
    $district=$_POST['district'];
    $pincode=$_POST['pin'];
    $state=$_POST['state'];
    $country=$_POST['country'];
    $email=$_POST['email'];

    // checking empty fields
    if(empty($name) || empty($password) || empty($confirmpassword) || empty($photo) || ($year=='select') || ($std == 'select') || ($section == 'select') || empty($rollno)  || empty($address) || empty($city)  || empty($district)  || empty($pincode)  || empty($state) || ($country == 'select') || empty($email))
    {
        //if name field is empty
        if(empty($name))
        {
            echo "<font color='red'>Name field is empty.</font><br/>";
        }
        //if password field is empty
        if(empty($password))
        {
            echo "<font color='red'>Password field is empty.</font><br/>";
        }
        //if confirm password field is empty
        if(empty($confirmpassword))
        {
            echo "<font color='red'>Confirm Password field is empty.</font><br/>";
        }

        //if password and confirm password does not match
        if(!($password == $confirmpassword))
        {
            echo "<font color='red'>Password and Confirm Password does not match.</font><br/>";
        }

        //if upload field is empty
        if(empty($photo))
        {
            echo "<font color='red'>Please upload your photo.</font><br/>";
        }

        //if year field is empty
        if($year == 'select')
        {
            echo "<font color='red'>Year field is not selected.</font><br/>";
        }

        //if standard field is empty
        if($std == 'select')
        {
            echo "<font color='red'>Please select the standard.</font><br/>";
        }

        //if year field is empty
        if($section == 'select')
        {
            echo "<font color='red'>Section field is not selected.</font><br/>";
        }

        //if rollno field is empty
        if(empty($rollno))
        {
            echo "<font color='red'>Roll Number field is empty.</font><br/>";
        }

        //if address field is empty
        if(empty($address))
        {
            echo "<font color='red'>Address field is empty.</font><br/>";
        }

        //if city field is empty
        if(empty($city))
        {
            echo "<font color='red'>City field is empty.</font><br/>";
        }

        //if district field is empty
        if(empty($district))
        {
            echo "<font color='red'>District field is empty.</font><br/>";
        }

        //if pincode field is empty
        if(empty($pincode))
        {
            echo "<font color='red'>pincode field is empty.</font><br/>";
        }

        //if state field is empty
        if(empty($state))
        {
            echo "<font color='red'>state field is empty.</font><br/>";
        }

        //if country field is empty
        if($country == 'select')
        {
            echo "<font color='red'>country field is not selected.</font><br/>";
        }

        //if email field is empty
        if(empty($email))
        {
            echo "<font color='red'>email field is empty.</font><br/>";
        }       
    }   
    else
    {   
        //updating the table
        //$result=mysql_query("UPDATE users SET name='$name',age='$age',email='$email' WHERE id=$id");

        $result = mysql_query("UPDATE user SET username='$name',pwd = '$password', confirmpwd = '$confirmpassword', photo = '$photo', year='$year', std = '$std', section = '$section', rollno = '$rollno', address = '$address', city = '$city', district = '$district', pincode = '$pincode',  state = '$state', country = '$country', email = '$email'  WHERE userid=$userid ");

        //redirectig to the display page. In our case, it is index.php
        header('Location: index.php');
    }
}
?>
<?php
//for displaying data of this particular data

//getting id from url
$userid = $_GET['userid'];

//selecting data associated with this particular id
$result = mysql_query("SELECT * FROM user WHERE userid=$userid");


while($res = mysql_fetch_array($result))
{

    $name = $res['username'];
    $password = $res['pwd'];
    $confirmpassword = $res['confirmpwd'];
    $photo = $res['photo'];
    $year = $res['year'];
    $std = $res['std'];
    $section = $res['section'];
    $rollno = $res['rollno'];
    $address = $res['address'];
    $city = $res['city'];
    $district = $res['district'];
    $pincode = $res['pincode'];
    $state = $res['state'];
    $country = $res['country'];
    $email = $res['email']; 
}
?>

the above code for edit.php page

when in local I receive no err. but in online I receive the following err:

Warning: Cannot modify header information - headers already sent by (output started at /www/zxq.net/a/l/u/alumni/htdocs/edit.php:11) in /www/zxq.net/a/l/u/alumni/htdocs/edit.php on line 143 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/zxq.net/a/l/u/alumni/htdocs/edit.php on line 157  

Is it possible to correct ?

Dude just check that the given user has permision for access db..................

It's a simple problem...........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.