I really dunno wats wrong here. the firts query works but the second does not . please help...
There a these connected files:
save.php
<?php
include_once("classes/jewelry/item.class.php");
$inum = $_POST['ItemNo'];
$i=new item();
$i->ItemNo = $inum;
$i->ItemName= $_POST['ItemName'];
$i->CapitalPrice=$_POST['CapitalPrice'];
$i->SalePrice=$_POST['SalePrice'];
$i->Category=$_POST['Category'];
$i->Description=$_POST['Description'];
$i->save();
include_once("classes/jewelry/stock.class.php");
$j=new stock();
$j->ItemNo = $inum;
$j->NumStored= $_POST['Nload'];
$j->NumSold= 0;
$j->save();
header("Location:?unit=inventory&go=home&task=inventory_index");
exit();
?>
@item.class.php
class stock extends Core {
<some declaration of attributes>....
function save(){
$sql="INSERT INTO $this->coreTable(ItemNo,NumStored,NumSold)".
" VALUES('$this->ItemNo','$this->NumStored','$this->NumSold')";
$this->Execute($sql);
return $this->sqlOK;
}
}
and @clas_core.php
class Core {
<some declaration of attributes>....
function Execute($query) {
$this->result = mysql_query($query) or die('Error, query failed!!!');
$this->num_rows = mysql_num_rows( $this->result );
}
}
Well as for the firstquery concerning item.it is successfully inserted into the database but when it comes to the stock. no instance is inserted and it gives a Warning"
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\jewelry_system\classes\class_core.php on line 19
Error, query failed!!!
I dunno what wrong. am i violating somerule. coz thefirst query which exactlyis the same as second is working perfectly fine T_T