=============
Another thing, I've heavily extended CMSMS, because I wanted to use it for my clients website and he needs to add recipes and restaurants to his website. Therefore I've created some forms for him on separate pages, I've added tables to the MySQL database and now he can add/edit and delete recipes and restaurants. But now the coolstuff comes, I need to make some dbase queries before the added data can be displayed, but Smarty (or Stupidy as I sometimes feel) trips over my queries. I've created a User-Defined tag, with this in it:
Code: Select all
$maxRows_echorecept = 1;
$pageNum_echorecept = 0;
if (isset($_GET['pageNum_echorecept'])) {
$pageNum_echorecept = $_GET['pageNum_echorecept'];
}
$startRow_echorecept = $pageNum_echorecept * $maxRows_echorecept;
$colname_echorecept = "-1";
if (isset($_GET['type'])) {
$colname_echorecept = (get_magic_quotes_gpc()) ? $_GET['type'] : addslashes($_GET['type']);
}
mysql_select_db($database_sql, $sql);
$query_echorecept = sprintf("SELECT * FROM addons_recepten WHERE soort = '%s' ORDER BY id ASC", $colname_echorecept);
$query_limit_echorecept = sprintf("%s LIMIT %d, %d", $query_echorecept, $startRow_echorecept, $maxRows_echorecept);
$echorecept = mysql_query($query_limit_echorecept, $sql) or die(mysql_error());
$row_echorecept = mysql_fetch_assoc($echorecept);
if (isset($_GET['totalRows_echorecept'])) {
$totalRows_echorecept = $_GET['totalRows_echorecept'];
} else {
$all_echorecept = mysql_query($query_echorecept);
$totalRows_echorecept = mysql_num_rows($all_echorecept);
}
$totalPages_echorecept = ceil($totalRows_echorecept/$maxRows_echorecept)-1;
