I am having a problem with passing a $query variable to a mysql_query command. So if I do this I get an update in the database (which I wanted):
$query = "UPDATE master SET finished_size = '$finished_size' WHERE id = $id";
mysql_query ($query, $db);
However, I need to use a function to do this. I'm trying to use this code, but I am no longer able to get the update to the database that I wanted:
if ( !function_exists("testQuery") ) {
function testQuery($id) {
return 'UPDATE master SET finished_size = "$finished_size" WHERE id = $id';
}
}
$query = testQuery($id);
mysql_query ($query, $db);
I have tried many ways of doing this, but the $query variable which contains the string to pass to the mysql_query function doesn't seem to be recognized. But I don't know how else to do this the proper way.
Also, I realize mysql_query is an old function, but this is the code that I have to use because I'm working on very old software.