Warning: sqlite_query() expects parameter 1 to be resource, string given
I've looked all over the place and cant find a开发者_如何学C solution that helps my case. I hope someone can help?
I have this and receive
Warning: sqlite_query() expects parameter 1 to be resource, string given
It is 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>';
}
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);
}
You are either missing a call to sqlite_open(), or your $dbhandle
variable is not available in your function.
精彩评论