views:

40

answers:

2

ok so i've looked all over the place and cant find a solution that helps my case. I hope someone can help?

basically i have this, and recieve "Warning: sqlite_query() expects parameter 1 to be resource, string given" relating to $dbresult line - so a problem with the query :(

function Up(){ 
$dbquery = "DELETE FROM toolList WHERE toolId='".$data['toolId']."'";  
$dbresult = sqlite_query($dbhandle, $dbquery);  
}

foreach($result as $data){ 
 print '< a href="'.Up().'">DELETE!< /a>';  
}

Any advice would be really appreciated :)

Thanks

+1  A: 

Where is $dbhandle defined? I'm guessing it's a global variable, in which case you have to explicitly mention so within the Up function:

function Up(){ 
  global $dbhandle, $data, $dbresult;
  $dbquery = "DELETE FROM toolList WHERE toolId='".$data['toolId']."'";  
  $dbresult = sqlite_query($dbhandle, $dbquery);  
}
casablanca
great!! thanks, that gets rid of the warning, but doesnt seem to work still!
ivicyrusivi
it should grab $data from the foreach loop right?
ivicyrusivi
You probably want to pass `$data` as a parameter to `Up`.
casablanca
+1  A: 

You are either missing a call to sqlite_open(), or your $dbhandle variable is not available in your function.

dr Hannibal Lecter