-3

can someone help me with this problem??

here's the code that gives me that error

public function getResults($result)
{
 $rxarray = mysql_fetch_array($result);
 if(!is_array($rxarray))
{
 return FALSE;
}
 return $rxarray;
}

the line that specifically errors is

$rxarray = mysql_fetch_array($result);

i don't know why it keeps giving me and error

i use that code in here :

<?PHP
 if(isset($_POST["select"]))
 {
 $updateID = $_POST["updateID"];
 $results = $l->wherew("item_list","*","$updateID","ID");
 while($data = $l->getResults($results))
{

  $Item_Name = $_POST["updateItem_Name"];
  $l->setItemName($data["Item_Name"]);
  $In_Stock = $_POST["updateIn_Stock"];
  $l->setInStock($data["In_Stock"]);
  $Capital_Price = $_POST["updateCapital_Price"];
  $l->setCapitalPrice($data["Capital_Price"]);
  $Price = $_POST["updatePrice"];
  $l->setPrice($data["Price"]);
  $table = "item_list";
  $value = "default,'$Item_Name','$In_Stock','$Capital_Price','$Price'";
  $l->update($table,$value,$updateID);
  echo "Successfully Updated";
 }
}
?>

i can't finish my project :'(

ianneAB
  • 25
  • 9
  • Your method `$l->wherew ()` has failed, probably with a MySQL syntax error, and returned false instead of a resource. –  Oct 11 '14 at 04:21
  • i changed it already, my problem now is how can i retrieve from my database? – ianneAB Oct 11 '14 at 04:22

3 Answers3

1

Never assume it will work, always always check for errors:

$results = $l->wherew("item_list","*","$updateID","ID") 
               or die('Update failed: ' . mysql_error());
meda
  • 44,540
  • 14
  • 88
  • 122
0

The error says that you're not passing a resource parameter that required by mysql_fetch_array($res,$res_type).

I suspect this code below not returning a resource

$results = $l->wherew("item_list","*","$updateID","ID");

More info http://php.net/manual/en/function.mysql-fetch-array.php

zoom
  • 175
  • 1
  • 1
  • 11
0

mysql_fetch_array() expects the direct output of a mysql_query() function. You are getting results from $l->wherew(...), check to see if the function is returning the result of the mysql_query(...) function. More here: http://php.net/manual/en/function.mysql-fetch-array.php

Sumit
  • 31
  • 2