0

Hi Friends

I have pasted the code below which i was used in my project. But i am getting mysql_fetch_array() error. For your more information i have attached the screen shot of the error

Pls give me solution

<?php

// Inialize session
session_start();
include("../config.php");
// Check, if username session is NOT set then this page will jump to login page
if (!isset($_SESSION['username'])) {
        header('Location: index.php');
}
?>

<?php 
$siten1=$_GET['sitenamen'];
$nmritem_code=$_GET['NMR_item_code'];
?>

<?php
	$qry="select * from nmr where NMR_item_code='".$_REQUEST["nmritem_code"]."'";
	//echo $qry;
	$res=mysql_query($qry,$conn);
	$row=mysql_fetch_array($res);
	//echo $row["category_item"];
	?>
  <?php
	$qrysite="select * from nmr_boq_rate where NMR_item_code='".$_REQUEST["nmritem_code"]."' AND sitename='$siten1'";
	//echo $qrysite;
	$ressite=mysql_query($qrysite,$conn);
	$rowsite=mysql_fetch_array($ressite);
	?>
<?php
$date=date('Y-m-d'); 

if($_POST["submit"]=="Submit")
{
$q="INSERT INTO nmr_boq_rate(NMR_sitename,NMR_item_code,NMR_item,uom,NMR_BOQ,NMR_Rate)VALUES('".$_POST["NMR_sitename"]."','".$_POST["NMR_item_code"]."','".$_POST["NMR_item"]."','".$_POST["uom"]."','".$_POST["NMR_BOQ"]."','".$_POST["NMR_Rate"]."')";
	//echo $q;
		mysql_db_query($database,$q);
		$change=mysql_insert_id();
		?>
<script language="JavaScript">
self.close();
window.parent.focus(); 
window.opener.parent.location.reload()
</script>
<?php
} ?>

<?php
if($_POST["submit"]=="Update"){
$q="update nmr_boq_rate set NMR_BOQ ='".$_POST["NMR_BOQ"]."',NMR_Rate='".$_POST["NMR_Rate"]."' where NMR_item_code='".$_POST["nmritem_code"]."'";
	//echo $q;
	mysql_db_query($database,$q);
	$change=$_POST["nmritem_code"];
?>
<script language="JavaScript">
self.close();
window.parent.focus(); 
window.opener.parent.location.reload();
</script>
<?php	
}
?>

<?php
if($_POST["submit"]=="Delete"){
		$q="Delete from nmr_boq_rate where NMR_item_code='".$_POST["nmritem_code"]."' AND sitename='".$_POST["sitename"]."'";
		//echo $q;
		mysql_db_query($database,$q);
		$change=$_POST["nmritem_code"];
?>

<script language="JavaScript">
self.close();
window.parent.focus(); 
window.opener.parent.location.reload();
</script>

<?php } ?>

<link href="../billing_css.css" rel="stylesheet" type="text/css">
<form action="addbgnmritemrate.php" method="post" enctype="multipart/form-data" name="add_bgnmritemrate">
<table width="500" border="0" cellpadding="1" cellspacing="1" class="table_style1">
  <tr>
    <td width="198" height="30" class="textinner">Site Name</td>
    <td width="295" height="30">
      <input name="NMR_sitename" type="text" class="loginbtext" id="NMR_sitename" value="<?php echo $siten1; ?>" readonly="readonly"></td>
  </tr>
  <tr>
    <td height="30" class="textinner">NMR Item Code</td>
    <td height="30"><input name="NMR_item_code" type="text" class="loginbtext" id="NMR_item_code" value="<?php echo $row["NMR_item_code"]; ?>" readonly="readonly" /></td>
  </tr>
  <tr>
    <td height="30" class="textinner">NMR Item Name</td>
    <td height="30"><input name="NMR_item" type="text" class="loginbtext" id="NMR_item" value="<?php echo $row["NMR_item"]; ?>" readonly="readonly" /></td>
  </tr>
  <tr>
    <td height="30" class="textinner">UOM</td>
    <td height="30"><input name="uom" type="text" class="loginbtext" id="uom" value="<?php echo $row["uom"]; ?>" readonly="readonly" /></td>
  </tr>
  <tr>
  
    <td height="30" class="textinner">NMR Budget Qty</td>
    <td height="30"><input name="NMR_BOQ" type="text" class="loginbtext" id="NMR_BOQ" value="<?php echo $rowsite["NMR_BOQ"]; ?>" /></td>
  </tr>
  <tr>
    <td height="30" class="textinner">NMR Budget Rate</td>
    <td height="30"><input name="NMR_Rate" type="text" class="loginbtext" id="NMR_Rate" value="<?php echo $rowsite["NMR_Rate"]; ?>" /></td>
  </tr>
  <tr>
    <td height="30" class="textinner">&nbsp;</td>
    <td height="30">
	<?php if($row["NMR_item_code"]==$rowsite["NMR_item_code"]){?>
    <input type="submit" name="submit" value="Update" class="txtBox" onclick="return val()"> &nbsp; 
      <input type="submit" name="submit" value="Delete" class="txtBox"> <input type="hidden" name="id" value="<?php echo $_REQUEST["nmritem_code"];?>">
       <?php }else{ ?>
       <input type="hidden" name="id" value="<?php echo $_REQUEST["id"];?>"> 
      <input type="submit" name="submit" value="Submit" class="txtBox" onclick="return val()">
       <?php } ?>
      </td>
  </tr>
</table>
</form>
Attachments gnmr.jpg 42.89 KB
2
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by rpv_sen
0

i have an issue in Line number 26 the original code is below

$qrysite="select * from nmr_boq_rate where NMR_item_code='".$_REQUEST["nmritem_code"]."' AND sitename='$siten1'";

Now i Have changed it as below

$nmritem_code called in line number 14

$qrysite="select * from nmr_boq_rate where NMR_item_code='$nmritem_code' AND sitename='$siten1'";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.