Support » Allgemeine Fragen » Daten aus einer DB auf der Webseite anzeigen

  • Gelöst paxarion

    (@paxarion)


    Liebe Community,

    mein Problem ist vermutlich lachhaft einfach, aber ich bin völlig neu in der WP Welt und habe keine Erfahrungen mit PHP oder MySQL…

    Ich möchte eine Seite generieren die mir zum unteren Beispiel die Anzahl der Haustiere je nach gesetztem Parameter (Stadt) anzeigt.
    Zu der Anzahl sollen dann noch die Verbundenen Daten als Zusatzinformationen gezeigt werden (Land, Kontinent sowie Rasse)

    Die Daten sind in einer anderen Datenbank als der WP-eigenen abgelegt.
    Mein Hosting ist übrigens bei Strato.

    Folgende Struktur habe ich mir für die Datenbank überlegt:

    Tabelle: Kontinent			
    ID (PRIMARY)	Name (UNIQUE)		
    1	Europa		
    2	Afrika		
    3	Asien		
    			
    Tabelle: Länder			
    ID (PRIMARY)	Name (UNIQUE)	Kontinent-ID (SECONDARY)	
    1	Deutschland 	1	
    2	Österreich 	1	
    3	China	3	
    			
    Tabelle: Städte			
    ID (PRIMARY)	Name (UNIQUE)	Länder-ID (SECONDARY)	
    1	München	1	
    2	Berlin	1	
    3	Wien	2	
    			
    Tabelle: Rassen			
    ID (PRIMARY)	Name (UNIQUE)		
    1	Katze		
    2	Hund		
    3	Vogel		
    			
    Tabelle: Haustiere			
    ID (PRIMARY)	Name (UNIQUE)	Rassen-ID (SECONDARY)	
    1	Labrador	2	
    2	Spitz	2	
    3	Wellensittich 	3	
    			
    Tabelle: Population			
    ID (PRIMARY)	Städte-ID (SECONDARY)	Anzahl	Haustiere-ID (SECONDARY)
    1	1	5.500	1
    2	1	7.210	2
    3	1	12	3
    4	2	40	3
    5	3	6.490	1
    6	3	33	3

    ————————————————————————————————————————————

    Ich würde mich sehr über ein bisschen Starthilfe freuen.
    Sehr gerne auch Einführungen die in meine gehoffte Richtung gehen…

    Vielen Dank & Liebe Grüße,

    Pax

    ————————————————————————————————————————————

    
    ### wp-core ###
    
    version: 6.1.1
    site_language: de_DE
    user_language: de_DE
    timezone: +00:00
    permalink: /%category%/%postname%/
    https_status: false
    multisite: false
    user_registration: 0
    blog_public: 1
    default_comment_status: open
    environment_type: production
    user_count: 3
    dotorg_communication: true
    
    ### wp-paths-sizes ###
    
    wordpress_path: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app
    wordpress_size: 56,34 MB (59080820 bytes)
    uploads_path: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/uploads
    uploads_size: 574,04 kB (587814 bytes)
    themes_path: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/themes
    themes_size: 20,12 MB (21102478 bytes)
    plugins_path: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/plugins
    plugins_size: 174,71 MB (183195997 bytes)
    database_size: 2,23 MB (2342912 bytes)
    total_size: 253,97 MB (266310021 bytes)
    
    ### wp-dropins (1) ###
    
    fatal-error-handler.php: true
    
    ### wp-active-theme ###
    
    name: Ambitio (ambitio)
    version: 1.0
    author: ThemeZee
    author_website: https://themezee.com/
    parent_theme: none
    theme_features: post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, block-templates, widgets-block-editor, editor-style
    theme_path: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/themes/ambitio
    auto_update: Aktiviert
    
    ### wp-themes-inactive (5) ###
    
    FlatOn: version: 1.2.3, author: N. Venkat Raj, Automatische Aktualisierungen aktiviert
    Twenty Twenty-One: version: 1.7, author: WordPress-Team, Automatische Aktualisierungen aktiviert
    Twenty Twenty-Three: version: 1.0, author: WordPress-Team, Automatische Aktualisierungen aktiviert
    Twenty Twenty-Two: version: 1.3, author: WordPress-Team, Automatische Aktualisierungen aktiviert
    Writers: version: 4.2, author: Writerstheme, Automatische Aktualisierungen aktiviert
    
    ### wp-mu-plugins (3) ###
    
    Index WP MySQL For Speed Upgrade Filter for mu-plugins.: author: (undefined), version: 1.4.11
    WordPress automation by Installatron: author: (undefined), version: (undefined)
    WordPressSecureMode.php: author: (undefined), version: (undefined)
    
    ### wp-plugins-active (14) ###
    
    BSK PDF Manager: version: 3.4, author: BannerSky.com, Automatische Aktualisierungen aktiviert
    Guaven SQL Charts: version: 2.3.5, author: Guaven Labs, Automatische Aktualisierungen aktiviert
    Index WP MySQL For Speed: version: 1.4.11, author: Oliver Jones, Rick James, Automatische Aktualisierungen aktiviert
    Jetpack: version: 11.5.1, author: Automattic, Automatische Aktualisierungen aktiviert
    Limit Login Attempts Reloaded: version: 2.25.8, author: Limit Login Attempts Reloaded, Automatische Aktualisierungen aktiviert
    Simple Table Manager: version: 1.5.5, author: Ryo Inoue & lorro, Automatische Aktualisierungen aktiviert
    Site Kit by Google: version: 1.87.0, author: Google, Automatische Aktualisierungen aktiviert
    TablePress: version: 1.14, author: Tobias Bäthge, Automatische Aktualisierungen aktiviert
    Template Library and Redux Framework: version: 4.3.20, author: Extendify, Automatische Aktualisierungen aktiviert
    The Events Calendar: version: 6.0.4, author: The Events Calendar, Automatische Aktualisierungen aktiviert
    User Role Editor: version: 4.63.1, author: Vladimir Garagulya, Automatische Aktualisierungen aktiviert
    WPIDE - File Manager & Code Editor: version: 3.4.4, author: XplodedThemes, Automatische Aktualisierungen aktiviert
    WP phpMyAdmin: version: 5.2.0.7, author: Puvox.software, Automatische Aktualisierungen aktiviert
    Zapier for WordPress: version: 1.0.4, author: Zapier, Automatische Aktualisierungen aktiviert
    
    ### wp-plugins-inactive (3) ###
    
    Akismet Anti-Spam: version: 5.0.1, author: Automattic, Automatische Aktualisierungen aktiviert
    Strato Assistant: version: 7.3.0, author: Strato, Automatische Aktualisierungen aktiviert
    WPForms Lite: version: 1.7.8, author: WPForms, Automatische Aktualisierungen aktiviert
    
    ### wp-media ###
    
    image_editor: WP_Image_Editor_Imagick
    imagick_module_version: 1692
    imagemagick_version: ImageMagick 6.9.12-60 Q16 x86_64 17403 https://legacy.imagemagick.org
    imagick_version: 3.5.1
    file_uploads: File uploads is turned off
    post_max_size: 128M
    upload_max_filesize: 128M
    max_effective_size: 128 MB
    max_file_uploads: 20
    imagick_limits: 
    	imagick::RESOURCETYPE_AREA: 4 GB
    	imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
    	imagick::RESOURCETYPE_FILE: 192
    	imagick::RESOURCETYPE_MAP: 4 GB
    	imagick::RESOURCETYPE_MEMORY: 2 GB
    	imagick::RESOURCETYPE_THREAD: 1
    imagemagick_file_formats: 3FR, 3G2, 3GP, A, AAI, AI, APNG, ART, ARW, AVI, AVS, B, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, C, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DNG, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, FAX, FILE, FITS, FRACTAL, FTP, FTS, G, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, K, K25, KDC, LABEL, M, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, O, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, R, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCREENSHOT, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X3F, XBM, XC, XCF, XPM, XPS, XV, Y, YCbCr, YCbCrA, YUV
    gd_version: bundled (2.1.0 compatible)
    gd_formats: GIF, JPEG, PNG, WebP, BMP
    ghostscript_version: not available
    
    ### wp-server ###
    
    server_architecture: Linux localhost 3.10.0-1160.71.1.el7.x86_64 #1 SMP Linux localhost 3.10.0-1160.71.1.el7.x86_64 #1 SMP Linux localhost 3.10.0-1160.71.1.el7.x86_64 #1 SMP
    httpd_software: Apache/2.4.54 (Unix)
    php_version: 8.0.24 64bit
    php_sapi: cgi-fcgi
    max_input_variables: 4000
    time_limit: 240
    memory_limit: 512M
    max_input_time: 60
    upload_max_filesize: 128M
    php_post_max_size: 128M
    curl_version: 7.85.0 OpenSSL/1.1.1q
    suhosin: false
    imagick_availability: true
    pretty_permalinks: true
    htaccess_extra_rules: true
    
    ### wp-database ###
    
    extension: mysqli
    server_version: 5.7.38-log
    client_version: mysqlnd 8.0.24
    max_allowed_packet: 67108864
    max_connections: 3000
    
    ### wp-constants ###
    
    WP_HOME: undefined
    WP_SITEURL: undefined
    WP_CONTENT_DIR: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content
    WP_PLUGIN_DIR: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/plugins
    WP_MEMORY_LIMIT: 40M
    WP_MAX_MEMORY_LIMIT: 512M
    WP_DEBUG: false
    WP_DEBUG_DISPLAY: true
    WP_DEBUG_LOG: false
    SCRIPT_DEBUG: false
    WP_CACHE: false
    CONCATENATE_SCRIPTS: undefined
    COMPRESS_SCRIPTS: undefined
    COMPRESS_CSS: undefined
    WP_ENVIRONMENT_TYPE: Nicht definiert
    DB_CHARSET: utf8
    DB_COLLATE: undefined
    
    ### wp-filesystem ###
    
    wordpress: writable
    wp-content: writable
    uploads: writable
    plugins: writable
    themes: writable
    mu-plugins: writable
    0: Writable
    
    ### redux-framework ###
    
    version: 4.3.20
    installation: plugin
    data directory: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/plugins/redux-framework/redux-core/
    browser: 
    	Agent: Mozilla/5.0 (iPad; CPU OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/107.0.5304.101 Mobile/15E148 Safari/604.1
    	Browser: Chrome
    	Version: 107.0.5304.101
    	Platform: iPad
    
    ### jetpack ###
    
    site_id: 212372129
    ssl_cert: No
    time_diff: undefined
    version_option: 11.5.1:1668355255
    old_version: 11.5.1:1668355255
    public: Public
    master_user: Kein Masterbenutzer festgelegt.
    current_user: #1 admin
    tokens_set: Blog 
    blog_token: #iQPqwiPc#8GR&FERtpcB&rtTNumzoK1
    user_token: Not set.
    version: 11.5.1
    jp_plugin_dir: /mnt/web307/a3/04/512112204/htdocs/STRATO-apps/wordpress_01/app/wp-content/plugins/jetpack/
    plan: free
    protect_header: false
    full_sync: {"started":"Sun, 13 Nov 2022 16:13:02 +0000","finished":"Sun, 13 Nov 2022 16:13:13 +0000","progress":{"comments":{"total":"1","sent":1,"finished":true,"last_sent":"1"},"constants":{"finished":true},"functions":{"finished":true},"options":{"finished":true},"posts":{"total":"6","sent":6,"finished":true,"last_sent":"1"},"term_relationships":{"total":"1","sent":1,"finished":true,"last_sent":{"object_id":"1","term_taxonomy_id":"1"}},"terms":{"total":"4","sent":4,"finished":true,"last_sent":"1"},"themes":{"finished":true},"updates":{"finished":true},"users":{"total":"3","sent":3,"finished":true,"last_sent":"1"}},"config":{"comments":1,"constants":1,"functions":1,"options":1,"posts":1,"term_relationships":1,"terms":1,"themes":1,"updates":1,"users":1}}
    sync_size: undefined
    sync_lag: 0 seconds
    full_sync_size: undefined
    full_sync_lag: 0 seconds
    idc_urls: {"home":"http:\/\/angzarr.de","siteurl":"http:\/\/angzarr.de","WP_HOME":"","WP_SITEURL":""}
    idc_error_option: false
    idc_optin: true
    cxn_tests: All Pass.
    
    ### google-site-kit ###
    
    version: 1.87.0
    php_version: 8.0.24
    wp_version: 6.1.1
    reference_url: http://angzarr.de
    amp_mode: no
    site_status: not-connected
    user_status: not authenticated
    verification_status: not-verified
    connected_user_count: none
    active_modules: site-verification, search-console, analytics, analytics-4, pagespeed-insights
    recoverable_modules: none
    required_scopes: 
    	openid: ⭕
    	https://www.googleapis.com/auth/userinfo.profile: ⭕
    	https://www.googleapis.com/auth/userinfo.email: ⭕
    	https://www.googleapis.com/auth/siteverification: ⭕
    	https://www.googleapis.com/auth/webmasters: ⭕
    	https://www.googleapis.com/auth/analytics.readonly: ⭕
    capabilities: 
    	googlesitekit_authenticate: ✅
    	googlesitekit_setup: ✅
    	googlesitekit_view_posts_insights: ⭕
    	googlesitekit_view_dashboard: ⭕
    	googlesitekit_manage_options: ⭕
    	googlesitekit_view_splash: ✅
    	googlesitekit_view_authenticated_dashboard: ⭕
    	googlesitekit_view_wp_dashboard_widget: ⭕
    	googlesitekit_view_admin_bar_menu: ⭕
    enabled_features: 
    	adsenseSetupV2: ⭕
    	dashboardSharing: ⭕
    	ga4ActivationBanner: ⭕
    	ideaHubModule: ⭕
    	twgModule: ⭕
    	userInput: ⭕
    search_console_property: none
    analytics_account_id: none
    analytics_property_id: none
    analytics_profile_id: none
    analytics_use_snippet: yes
    analytics_4_property_id: none
    analytics_4_web_data_stream_id: none
    analytics_4_measurement_id: none
    analytics_4_use_snippet: yes
    
    

    Die Seite, für die ich Hilfe brauche: [Anmelden, um den Link zu sehen]

Ansicht von 5 Antworten - 1 bis 5 (von insgesamt 5)
  • Hallo,
    das ist eher etwas für ein Forum wie z. B. https://wordpress.stackexchange.com/
    Hier befassen wir uns mehr mit Anwenderproblemen bei Nutzung von WordPress.

    Viele Grüße
    Hans-Gerd

    WordPress verwendet eine Reihe von eigenen Funktionen, um möglichst sicher Beiträge aus der Datenbank abzulegen und auch wieder abzurufen. Es ist sinnvoll, diese Funktionen auch für andere Daten zu nutzen.

    Die meisten Entwickler werden deshalb wahrscheinlich einen „Custom Post Type“ (eine eigene Beitragsart) haustier einrichten, um die Tiere zu erfassen. Um gezielt nach Ländern, Tierart, Geschlecht, Population usw. abfragen zu können, kannst du jeweils eine „Custom Taxonomy“ einrichten, eigene Sortierkriterien vergleichbar mit Kategorien und Schlagwörtern. Nach diesen Taxonomie-Begriffen kannst du dann deine Custom Posts ganz gezielt filtern.

    Alle genannten Bestandteile sind in der WordPress-Dokumentation ausführlich beschrieben, aber viele Anwender gehen eher den pragmatischen Weg und nutzen für die Erstellung eines Custom Post Type z.B. Custom Post Type UI, für Custom Taxonomy Advanced Custom Fields und eines der verschiedenen Filter-Plugins, um auch im Frontend eine Auswahl vornehmen zu können. Für die Ausgabe musst du dann allerdings immer noch ein wenig programmieren, um die entsprechenden Templates zu erstellen.

    Bei Fragen zur Programmierung bist du (wie schon von Hans-Gerd angemerkt) bei WordPress Stackexchange besser aufgehoben – hier möchten wir vor allem Anwendungs-Support anbieten.

    Moderator Michi91

    (@michi91)

    Thread-Starter paxarion

    (@paxarion)

    Vielen lieben Dank für eure Hilfe! 😃

    @paxarion
    Schön für uns und Mitleser wäre, wenn du noch kurz darstellst, wie du das Problem lösen konntest.

Ansicht von 5 Antworten - 1 bis 5 (von insgesamt 5)
  • Das Thema „Daten aus einer DB auf der Webseite anzeigen“ ist für neue Antworten geschlossen.