Quote by machinari:
My apologies to those of you who are stuck with lazy hosts. Feel free to flame me. Better yet, inform me of ways that these issues may be resolved peacefully.
Like I said, I myself will just write something myself if you don't support MySQL pre-4. Regarding suggestions for "peaceful resolution" (I was never planning to flame you) though, one-to-many relationships have been around for a long time, so one quote having several categories is possible to do with standard SQL (enterprise DB systems like Oracle still don't have multi-table deletes. Well, I can't speak for Oracle 9i).
It would just have to be one SQL statement per table, that's all...
[ ... update ... ]
In fact, I just modified my manage.php so it'll work for me. I just changed the del_quote function from:
Text Formatted Code
function del_quote($qid){
global $_DQ_TABLES, $LANG_DAILYQUOTE;
$sql = "DELETE {$_DQ_TABLES['dailyquote_quotes']}, {$_DQ_TABLES['dailyquote_lookup']}";
$sql .= " FROM {$_DQ_TABLES['dailyquote_quotes']}, {$_DQ_TABLES['dailyquote_lookup']}";
$sql .= " WHERE {$_DQ_TABLES['dailyquote_quotes']}.ID=$qid";
$sql .= " AND $qid={$_DQ_TABLES['dailyquote_lookup']}.QID";
if (!DB_query($sql)){
$retval = "<p align="center" style="font-weight: bold; color: red;">" . $LANG_DAILYQUOTE['delerror'] . "</p>";
COM_errorLog("An error occured while deleting a quotation",1);
} else {
$retval = "<p align="center" style="font-weight: bold; color: red;">" . $LANG_DAILYQUOTE['delsuccess'] . "</p>";
COM_errorLog("Deleted Quotation and related data. Q.ID = $qid",1);
}
return $retval;
}
to:
Text Formatted Code
function del_quote($qid){
global $_DQ_TABLES, $LANG_DAILYQUOTE;
// 20041001 make delete MySQL 3 compatible
$del_error=0;
$sql = "DELETE FROM {$_DQ_TABLES['dailyquote_quotes']} WHERE ID=$qid";
if (!DB_query($sql)){
$del_error=1;
} else {
// continue only if first SQL was successful
$sql2 = "DELETE FROM {$_DQ_TABLES['dailyquote_lookup']} WHERE QID=$qid";
if (!DB_query($sql2)){
$del_error=1;
}
}
if ($db_error == 0){
$retval = "<p align="center" style="font-weight: bold; color: red;">" . $LANG_DAILYQUOTE['delsuccess'] . "</p>";
COM_errorLog("Deleted Quotation and related data. Q.ID = $qid",1);
} else {
$retval = "<p align="center" style="font-weight: bold; color: red;">" . $LANG_DAILYQUOTE['delerror'] . "</p>";
COM_errorLog("An error occured while deleting a quotation",1);
}
return $retval;
}
It's only a few more lines and works fine, tested with MySQL 3.23.56