Hongmu Notes
Home Program Notes EmpireCMS retrieves database articles based on an ID.
Program Notes Empire cms

EmpireCMS retrieves database articles based on an ID.

EmpireCMS retrieves database articles based on an ID.

Query the `news` table for articles using the provided article ID:

$id=(int)$_GET['id'];
$r=$empire->fetch1("select * from {$dbtbpre}ecms_news where id=$id");
$classid=(int)$r['classid'];

Fallback query code for determining whether a `classid` has been provided:

// print_r($_GET);die;
if(empty($_GET['classid'])){
    $id=(int)$_GET['id'];
    $r=$empire->fetch1("select * from {$dbtbpre}ecms_news where id=$id");
    $classid=(int)$r['classid'];
}else{
    $id=(int)$_GET['id'];
    $classid=(int)$_GET['classid'];
}

Comprehensive Code 2.0:

// print_r($_GET);die;
if(empty($_GET['classid'])){
    $id=(int)$_GET['id'];
    $r=$empire->fetch1("select * from {$dbtbpre}ecms_news where id=$id");
    if (empty($r['id'])) {
        printerror('此信息不存在','',1,0,1);
    }
    $classid=(int)$r['classid'];
}else{
    $id=(int)$_GET['id'];
    $classid=(int)$_GET['classid'];
}

 

微信赞赏

WeChat

支付宝赞赏

Alipay

✍️ Author: Hong Mu

webmaster · Thanks for reading, stay tuned for more exciting content

Author homepage View home page →

Related articles

Empire CMS database statement & SQL statement format

Empire CMS database statement & SQL statement format Program Notes Empire cms

Introduction to Imperial CMS extended SQL program writing, basic examples of Imperial CMS database statements & SQL statement formats: Note: The following examples are based on placing PHP files in the system root directory. Example 1: Connect to MYSQL program. (a.php)<?php require('e/class/connect.php'); //Introduce database configuration files and public function files requ…
👁 351
Empire CMS obtains the system COOKIE variable function getcvar()

Empire CMS obtains the system COOKIE variable function getcvar() Program Notes Empire cms

Get the system COOKIE variable function syntax: getcvar($var,$ecms) Description: $var: is the variable name $ecms: 0 is to set the foreground COOKIE variable, 1 is to set the background COOKIE variable. This parameter can be omitted and defaults to 0. Usage example: getcvar('mlusername'), get the user name of the front-end login member getcvar('loginu...
👁 295
Empire CMS smart label call field collection

Empire CMS smart label call field collection Program Notes Empire cms

Collect and classify all fields that support smart tag calls into Empire CMS smart tags: [e:loop={column ID/topic ID, number of items displayed, operation type, only display pictures with titles, additional SQL conditions, display sorting}] Template code content [/e:loop] Calling time: <?=date('m-d',$bqr[newstime])?> <?=dat…
👁 3749

Recommended reading

Website optimization adds a music player

Website optimization adds a music player Summary of pitfalls

Plug-in effect: It is used to improve website user experience, such as Baidu ranking. If you install this plug-in, your website's bounce rate may be reduced, which is naturally good for rankings. You know what you know. I had nothing to do today and found a music player website. It only needs a piece of js code to let you play music. It is quite powerful. You only need to go to their website to register and get the js code. So I installed it and played it. The result was not bad, but the main website was too stuck...
👁 155
A single database record for WordPress operations

A single database record for WordPress operations Program Notes wordpress

I'm documenting my code – its primary function is to handle WordPress database connections and operations. Since I might need this again in the future, I've decided to record it here; this way, when I need to use it next time, I can simply copy and paste it. As it turns out, taking notes can really save some time! First code snippet: "`php // Include the WordPress core file: require_once(dirname(__FILE__));" `
👁 173
(Adaptive mobile version) Fire extinguisher – dry powder firefighting equipment; PBootCMS website template; Red firefighting equipment website source code download – 0364

(Adaptive mobile version) Fire extinguisher – dry powder firefighting equipment; PBootCMS website template; Red firefighting equipment website source code download – 0364 Practical Collection pbootcms Template

An adaptive mobile-friendly fire extinguisher and firefighting equipment website template for PbootCMS – Red Fire Safety Equipment Website Template. This template features a striking and professional design, ideal for showcasing fire extinguishers, firefighting equipment, and safety solutions. It enables firefighting equipment manufacturers to showcase their products online and attract both corporate and government procurement opportunities. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5....
👁 39
(Adaptive Mobile Version) Kitchen Waste Treatment Equipment Website Template 1083

(Adaptive Mobile Version) Kitchen Waste Treatment Equipment Website Template 1083 Practical Collection pbootcms Template

A PbootCMS website template for kitchen waste treatment equipment, compatible with both PC and WAP devices. Its modern, tech-driven and eco-friendly design is ideal for showcasing kitchen waste treatment systems, technical solutions, and the environmental benefits of such equipment. This template helps environmental equipment manufacturers showcase their products online and attract municipal and commercial clients. Template Display | Installation Instructions | Website Backend: /admin.php | Username: admin | Password: admin | Extraction Password: www.4s5.c...
👁 49
Mechanical Snow Removal Equipment Website Template 0652

Mechanical Snow Removal Equipment Website Template 0652 Practical Collection Yiyou template

An eyoucms website template for mechanical snow clearing equipment companies. The design style is professional and practical, and can display snow clearing equipment products, technical parameters, industrial applications and engineering cases. It helps machinery and equipment companies display their products online and attract municipal and property customers. Template display Installation instructions Website backend: /login.php Account: admin Password: admin Related articles Summary of common problems in Yiyou CMS installation Yi...
👁 37