WEBALGO.CH

MySQLi-DatenbankPHP MySQLiSuchmaschinenoptimierungSuchmaschinenmarketingSuchmaschinenwerbung

Vorlagen für die Erstellung von Websites



Ab 25.3.21: UMFRAGE zum Thema Websiteerstellung

Tragen Sie sich in den Newsletter ein!

Algorithms for the web


Learn to create your own individual website from scratch: Use the instructions from WEBALGO.CH with templates to download for the construction and maintenance of your customized website as well as the operation of MySQLi databases with the scripting language PHP for download!

Would you like to have your individual website created by WEBALGO.CH? Contact me using the contact form! Would you like an appointment for a video conversation on Google Meet or Skype?



detect a mobile device and redirect width PHP

basic table in html

Show last modification of a file with PHP

Load content after click on checkbox with PHP

Load Facebok-chatbot in with PHP

Create a table in MySQLi

Connect width MySQLi

Read record from MySQLi

Read record from MySQLi according to conditions

WEBALGO: Learn algorithms and create, code a website







Search

Suchen in Datenbank:


Ganze Website durchsuchen:

Kleine rekursive Suchmaschine


Eine Suchmaschine von Werner Zenke

VORLAGEN

Zu deren Bearbeitung empfohlen: Windows Texteditor


ALLE Vorlagen als ZIP-Datei herunterladen

Vorlagen als PrintScreens

Das CSS-Stylesheet: Zentrale Steuerung von Layouts
DOWNLOAD

p { font-family: Arial; font-size: 1.0em; color: black } p1 { font-family: Arial; font-size: 1.1em; color: black } A:link { text-decoration: none; color: #c0392b; } A:visited { text-decoration: none; color: #c0392b; } A:active { text-decoration: none; color: #c0392b; } A:hover { text-decoration: none; color: #c0392b; } background-repeat: no-repeat;

Das HTML-Grundgrüst:
DOWNLOAD

<html> <head> <title>WEBALGO.CH</title> <link rel="stylesheet" href="webalgo.css"> </head> <body> <p class=1>Hier steht der Inhalt der Webiste!</p> </body> </html>

Der Platzhalter:
DOWNLOADDOWNLOAD transparentes Bild ph.png

<img src="ph.png" height="20" width="20">

Die HTML-Tabelle
DOWNLOAD

<table border="1">
<tr>
<td bgcolor="grey"><img src="ph.png" height="20" width="20"></td>
<td></td>
<td bgcolor="grey"><img src="ph.png" height="20" width="20"></td>
</tr>
<td></td>
<td><p class=1>Hier steht der Text<br>ph.png zwecks Illustration grau.</p></td>
<td></td>
</tr>
<tr>
<td bgcolor="grey"><img src="ph.png" height="20" width="20"></td>
<td></td>
<td></td>
</tr>
</table>


Hier steht der Text
ph.png zwecks Illustration grau.


Das HTML-Grundgrüst: Websitevorlage als Grundgerüst mit dynamischer Einbindung von Content
DOWNLOAD/DOWNLOAD mit Zusatzdateien (head-browserweiche.php ...)

<html>
<head>
<title>WEBALGO Vorlagen</title>
</head>
<body>
<a name="home"></a>
<br>
<img src="https://webalgo.ch/ph.png" height="45" width="1">
<br>

<?php include '../head-browserweiche-vorlagen.php';?>
<body>
<?php include '../fbplugin.html';?>
<?php
include '../VORLAGEN/detectmobilebrowser.php';
?>

<table border="0" width="100%" height="100%">
<tr>
<td><img src="https://webalgo.ch/ph.png" height="1" width="30"></td>
<td></td>
<td></td>
</tr>

<tr>
<td></td>
<td valign="top">
<?php
include '../vorlagen.php';
?>

</td>
<td></td>
</tr>
</table>
<?php
include '../cookie.html';
?>
<div align="center">
<!--
<blockquote class="twitter-tweet"><p lang="de" dir="ltr">Voller Funktionsumfang zum Nulltarif! Videokonferenzen bleiben mit Hostpoint Meet auch weiterhin komplett kostenlos und ohne Zeitlimite.<a href="https://t.co/vwAkJ5Wvo4">https://t.co/vwAkJ5Wvo4</a><a href="https://twitter.com/hashtag/videokonferenz?src=hash&amp;ref_src=twsrc%5Etfw">#videokonferenz</a> <a href="https://twitter.com/hashtag/meet?src=hash&amp;ref_src=twsrc%5Etfw">#meet</a> <a href="https://twitter.com/hashtag/googlemeet?src=hash&amp;ref_src=twsrc%5Etfw">#googlemeet</a> <a href="https://t.co/f7TQENungg">pic.twitter.com/f7TQENungg</a></p>&mdash; Hostpoint (@hostpoint) <a href="https://twitter.com/hostpoint/status/1311655011806576645?ref_src=twsrc%5Etfw">October 1, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> </div>
-->
<script type="text/javascript">
var uri = 'https://impch.tradedoubler.com/imp?type(img)g(22037596)a(3191237)' + new String (Math.random()).substring (2, 11);
document.write('<a href="https://clk.tradedoubler.com/click?p=90917&a=3191237&g=22037596" target="_BLANK"><img src="'+uri+'" border=0></a>');
</script>
<?php
include '../javascript-home.html';
?>
</body>
</html>

Mobilen Browser erkennen und entsprechend weiterleiten:
DOWNLOAD

<?php
$useragent
=$_SERVER['HTTP_USER_AGENT'];
if(
preg_match('/(android|bb\d+|meego).+mobile|...|bada\/(0yas\-|zte\-/i',substr($useragent,0,4)))
header('Location: MOBILE/MOBILE/');
?>


Oder

<?php
$useragent
=$_SERVER['HTTP_USER_AGENT'];

if(
preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))

echo(
'xy');
?>


Mobilen Browser erkennen und entsprechendes CSS laden:
DOWNLOAD

<?php
$useragent
=$_SERVER['HTTP_USER_AGENT'];
if(
preg_match('/(android|bb\d+|meego).+mobile|)...|op(ti|wv)|p-[2-t,0,4)))
{
include('
head-mobile.php');
}
else 
{
include('
head-desktop.php');
}
?>


CSS Dekstop:
DOWNLOAD

<head>
<title>WEBALGO.CH Algorithmen für das Web</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<!-- TradeDoubler site verification 3191237 -->
<title><?php include 'titel.txt';?></title>
<link rel="stylesheet" href="webalgo.css">
<script type='text/javascript' src='https://platform-api.sharethis.com/js/sharethis.js#property=5fa529a47efc200012ec7062&product=sop' async='async'></script>
<script data-ad-client="ca-pub-3255978515549111" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<link rel="canonical" href="http://webalgo.ch/" />
<meta name="description" content="Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." />
<meta name="robots" content="index">
<meta name="audience" content="all">
<meta name="revisit-after" content="7 days"> 
<meta name="copyright" content="Markus Müller" />
<meta name="author" content="Markus Müller" />
<meta name="LANGUAGE" content="de" />
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<meta https-equiv="expires" content="0" />
<!--

* * * * * Design & Development: Markus Müller
* * * * * www.webalgo.ch
* * * * * © 2021

-->
<script type='application/ld+json'>
{
  "@context": "http://www.schema.org",
  "@type": "ProfessionalService",
  "name": "webalgo",
  "url": "https://webalgo.ch",
  "logo": "https://webalgo.ch/ginkoblatt-webalgo.jpg",
  "priceRange": "$$$$",
  "description": "WEBALGO Algorithmen für das Web",
  "address": {
     "@type": "PostalAddress",
     "streetAddress": "Seestrasse 270",
     "addressLocality": "Uerikon",
     "addressRegion": "ZH",
     "postalCode": "8713",
     "addressCountry": "Schweiz"
  },
  "telephone": "+41787704710"
}
</script>
<!-- https://jsonld.com/json-ld-generator/ -->
</head>
<!-- meta property: an Beispiel von TESLA.COM orientiert. 27.04.21 implementiert -->


CSS Mobile:
DOWNLOAD

<head>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<title><?php include 'titel.txt';?></title>
<link rel="stylesheet" href="webalgo-mobile.css">
<script type='text/javascript' src='https://platform-api.sharethis.com/js/sharethis.js#property=5fa529a47efc200012ec7062&product=sop' async='async'></script>
<script data-ad-client="ca-pub-3255978515549111" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<meta name="description" content="WEBALGO.CH bietet Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript und anderen Sprachen an. Lernen eine Website mit HTML und CSS sowie PHP auf aufzubauen. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." />
<meta name="keywords" content="algorithmen, browserweiche, chatbot, chechbox, css, datenbank, html, htmltabelle, htmlgrundgerüst, mysqli, opportunitätskosten, php, platzhalter, sitemap, stylesheet, vorlagen, web, Webalgo, webalgorithmen, websitevorlage, wysiwig" />
<meta name="robots" content="all"/>
<meta property="og:site_name" content="WEBALGO" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.webalgo.ch/" />
<meta property="og:title" content="WEBALGO.CH: Algorithmen für das WEB" />
<meta property="og:description" content="WEBALGO.CH bietet Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript und anderen Sprachen an. Lernen eine Website mit HTML und CSS sowie PHP auf aufzubauen. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." />
<meta property="og:site_name" content="WEBALGO" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.webalgo.ch/" />
<meta property="og:title" content="WEBALGO.CH: Algorithmen für das WEB" />
<meta property="og:description" content="WEBALGO.CH bietet Vorlagen für die Erstellung von Websiten auf Basis von HTML, PHP, MySQLi und JavaScript und anderen Sprachen an. Lernen eine Website mit HTML und CSS sowie PHP auf aufzubauen. Lernen Datenbanken zu betreiben und mit PHP zu manipulieren und abzurufen." />
<meta property="og:image" content=" https://www.webalgo.ch/ginkoblatt.jpeg">
<meta property="og:image:secure_url" content="https://www.webalgo.ch/ginkoblatt-webalgo.jpg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="627">
<meta property="og:image:alt" content="WEBALGO.CH Algorithmen für das Web">
<!--

* * * * * Design & Development: Markus Müller
* * * * * www.webalgo.ch
* * * * * © 2021

-->
<script type='application/ld+json'>
{
  "@context": "http://www.schema.org",
  "@type": "ProfessionalService",
  "name": "webalgo",
  "url": "https://webalgo.ch",
  "logo": "https://webalgo.ch/ginkoblatt-webalgo.jpg",
  "priceRange": "$$$$",
  "description": "WEBALGO Algorithmen für das Web",
  "address": {
     "@type": "PostalAddress",
     "streetAddress": "Seestrasse 270",
     "addressLocality": "Uerikon",
     "addressRegion": "ZH",
     "postalCode": "8713",
     "addressCountry": "Schweiz"
  },
  "telephone": "+41787704710"
}
</script>
<!-- https://jsonld.com/json-ld-generator/ -->
</head>
<!-- meta property: an Beispiel von TESLA.COM orientiert. 27.04.21 implementiert -->

Datum letzte Modifikation einer Datei
DOWNLOAD

<?php
// Ausgabe z.B.  index.php wurde zuletzt modifiziert: December 29 2002 22:16:23.

$filename 'index.php';
if (
file_exists($filename)) {
    echo 
"Zuletzt modifiziert: " date ("d. M Y"filemtime($filename));
}
?>

Checkbox: Inhalte laden nach Bestätigung der Checkbox
DOWNLOAD

<!-- https://makitweb.com/get-checked-checkboxes-value-with-php/ -->
<form method="post" action="">
    
    <input type="checkbox" name='bestaetigen[]' value="bestaetigen"> <b>Ich stimme zu:</b> Statement... 
<br><br><img src="ph.png" width="20" height="1">
    <input type="submit" value="senden" name="submit">
</form><br><img src="ph.png" width="1" height="20"><br>

<?php
if(isset($_POST['submit'])){

    if(!empty(
$_POST['bestaetigen'])) {

        foreach(
$_POST['bestaetigen'] as $value){
            include 
'deinedatei.php';
        }

    }

}
?>

Chatbot (Facebook: Seite mit Chatbot einrichten und anhand page-id verbinden) einbinden:
DOWNLOAD

<!-- Load Facebook SDK for JavaScript -->
      <div id="fb-root"></div>
      <script>
        window.fbAsyncInit = function() {
          FB.init({
            xfbml            : true,
            version          : 'v5.0'
          });
        };

        (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = 'https://connect.facebook.net/de_DE/sdk/xfbml.customerchat.js';
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));</script>

      <!-- Your customer chat code -->
      <div class="fb-customerchat"
        attribution=setup_tool
        page_id="115900033588283"
  logged_in_greeting="Willkommen beim Chatbot von WEBALGO.CH!"
  logged_out_greeting="Willkommen beim Chatbot von WEBALGO.CH!">
      </div>


Facebook-Seite:





Chatbot auf MANYCHAT.COM:




Die MySQLi-Tabelle: (Ausführbar in der Datenbank)
DOWNLOAD

CREATE TABLE `kunden` ( `kunde_id_ins` int(10) NOT NULL, `name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL, `adresse` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL, `telefon` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL, `geburtstag` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL, `text` varchar(5000) COLLATE utf8mb4_unicode_ci NOT NULL, `code_kunde` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL, `timestamp` timestamp NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;


Verbindung zur MySQLi-Datenbank (Datei dbconnect.php)
DOWNLOAD

<?php
$link 
mysqli_connect("host""user""passwort""datenbankname");
if(
$link)
{
  echo 
'';
}

if(!
$link)
{
  exit(
"Die Datenbankverbindung ist gescheitert! ".mysqli_connect_error());
}
?>

MySQLi-Datenbank Abfrage Datum limitiert: Bsp.: Dat. < 20201025
DOWNLOAD

curdate = date('Ymd');       

$sql = "SELECT * FROM tabelle where ablaufdatum = '' OR ablaufdatum > $curdate order by schluesselwort";

Erfassen von Einträgen in die Datenbank
DOWNLOAD

<html>
<head>
<title>POST ERFASSEN</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<script>
    function printDiv(divName) {
        var printContents = document.getElementById(divName).innerHTML;
        var originalContents = document.body.innerHTML;
        document.body.innerHTML = printContents;
        window.print();
        document.body.innerHTML = originalContents;
    }
</script>
<font size="3" face="Arial">
<div id="main">
<div id="login">
<br>
<form action="" method="post">
<div id="printableArea">
<table cellspacing="10 border="0">
<tr>
<td>
<label>Post:</label>
</td>
<td></td>
<td><input type="text" name="post" id="post" required="required" placeholder="Fügen Sie den Code Ihres Postes hier ein"/>
</td>
</tr>

<tr>
<td>
<label>Code (notieren!):</label>
</td>
<td></td>
<td>
    <input type="text" name="code_post" id="code_post" readonly="readonly" value="<?php 
        
function gen_random_string($length=6)
        {
            
$chars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
            
$final_rand ='';
            for(
$i=0;$i<$length$i++)
            {
                
$final_rand .= $charsrand(0,strlen($chars)-1)];
            }
            return 
$final_rand;
        }
        echo 
gen_random_string()."\n"//generates a string 
        
?>" />
</td>
</tr>
<tr>
<td></td><td></td>
</tr>
<tr>
<td></td><td><img src="ph.png" height="20" width="20"></td>
</tr>
<!--
<tr>
<td><div class="g-recaptcha" data-sitekey="6LeKvtEUAAAAAGIYpPS6gOOONegG3AnkNGNP0Ee6"></div></td>
</tr>
-->
<tr>
<td><input type="submit" value=" Senden " name="submit"/><br /></td>
</tr>

</table>
</div>


</form>

</div>
<!-- Right side div -->

<div id="delete">
<br>
</div><br><br>
<div id="formget">
<a href=https://www.formget.com/app><img src="formget.jpg" alt="Online Form Builder"/></a>
</div>

</div>
<?php
if(isset($_POST["submit"])){
include 
'dbconnect.php';

// Create connection
$conn = new mysqli($servername$username$password$dbname);
// Check connection
if ($conn->connect_error) {
die(
"Connection failed: " $conn->connect_error);
}

$sql "INSERT INTO deinetabelle (beispiel,code_beispiel)
VALUES ('"
.$_POST["beispiel"]."','".$_POST["code_beispiel"]."')";

if (
$conn->query($sql) === TRUE) {
echo 
"<script type= 'text/javascript'>alert('New record created successfully');</script>";
} else {
echo 
"<script type= 'text/javascript'>alert('Error: " $sql "<br>" $conn->error."');</script>";

}

$conn->close();
}
?>

</font>
</body>
</html>
<!--
https://www.formget.com/php-mysqli-insert/
-->

Auslesen von Datensätzen aus der Datenbank
DOWNLOAD

<font size="3" face="Arial">

<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
include 'dbconnect.php';
 
// Check connection
if($link === false){
    die(
"ERROR: Could not connect. " mysqli_connect_error());
}
 
// Attempt select query execution
$sql "SELECT * FROM deinetabelle order by xy ASC";

if(
$result mysqli_query($link$sql)){
    if(
mysqli_num_rows($result) > 0){
       echo 
"<table>";
            echo 
"<tr>";
                echo 
"<td align=left><b></b></td>";
                echo 
"<td align=left></td>";
            echo 
"</tr>";
            echo 
"<tr>";
                echo 
"<td colspan=9><hr></td>";
            echo 
"</tr>";
        while(
$row mysqli_fetch_array($result)){
            echo 
"<tr>";
                echo 
"<td align=left valign=top>" $row['post'] . "</td>";
                echo 
"<td align=left></td>";

           echo 
"</tr>";
            echo 
"<tr>";
                echo 
"<td colspan=3><hr></td>";
            echo 
"</tr>";
        }
        echo 
"</table>";
        
// Free result set
        
mysqli_free_result($result);
    } else{
        echo 
"No records matching your query were found.";
    }
} else{
    echo 
"ERROR: Could not able to execute $sql. " mysqli_error($link);
}
 
// Close connection
mysqli_close($link);
?>


</font>

Auslesen von Datensätzen aus der Datenbank mit Bedingungen
DOWNLOAD

<font size="3" face="Arial">

<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
include 'dbconnect.php';
 
// Check connection
if($link === false){
    die(
"ERROR: Could not connect. " mysqli_connect_error());
}
 
// Attempt select query execution
$sql "SELECT * FROM deinetabelle where deindatenbaneintrag like '%#beispiel%' AND freigabe = 0 order by id_somposts ASC";

if(
$result mysqli_query($link$sql)){
    if(
mysqli_num_rows($result) > 0){
       echo 
"<table>";
            echo 
"<tr>";
                echo 
"<td align=left><b></b></td>";
                echo 
"<td align=left></td>";
            echo 
"</tr>";
            echo 
"<tr>";
                echo 
"<td colspan=9><hr></td>";
            echo 
"</tr>";
        while(
$row mysqli_fetch_array($result)){
            echo 
"<tr>";
                echo 
"<td align=left valign=top>" $row['post'] . "</td>";
                echo 
"<td align=left></td>";

           echo 
"</tr>";
            echo 
"<tr>";
                echo 
"<td colspan=3><hr></td>";
            echo 
"</tr>";
        }
        echo 
"</table>";
        
// Free result set
        
mysqli_free_result($result);
    } else{
        echo 
"No records matching your query were found.";
    }
} else{
    echo 
"ERROR: Could not able to execute $sql. " mysqli_error($link);
}
 
// Close connection
mysqli_close($link);
?>


</font>

Suchen von Datensätzen in der Datenbank: Suchformular
DOWNLOAD

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Search</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
    <form action="suchformular-script.php" method="post"><p class=1><font size=+2>Durchsuchen Sie die Posts nach Suchbegriffen: 
        <input type="text" id="suchbegriff" name="suchbegriff" /><img src="ph.png" height="1" width="20">
        <input type="submit" value="Posts durchsuchen" />
    </form>
</p>
</body>
</html>

Suchen von Datensätzen in der Datenbank: Script zum Suchformular
DOWNLOAD

<html>
<head>
<title>SOMPOSTS.CH Ergebnisse nach Suchbegriff</title>
<link rel="stylesheet" type="text/css" href="klins.css" media="screen" />
</head>
<body>
<div align="center">

<?php
include 'top.php';
?>


<font size="5" face="Arial"><a href="index.php">ZUR&Uuml;CK</a><br>
<font size="3" face="Arial">
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
include 'dbconnect.php';
 
// Check connection
if($link === false){
    die(
"ERROR: Could not connect. " mysqli_connect_error());
}
 
// Attempt select query execution
$suchbegriff $_POST["suchbegriff"];
$sql "SELECT * FROM deinetabelle where beispiel like '%$suchbegriff%' order by post ASC";
if(
$result mysqli_query($link$sql)){
    if(
mysqli_num_rows($result) > 0){
       echo 
"<table>";
            echo 
"<tr>";
                echo 
"<td align=left><b></b></td>";
            echo 
"</tr>";
            echo 
"<tr>";
                echo 
"<td><hr></td>";
            echo 
"</tr>";
        while(
$row mysqli_fetch_array($result)){
            echo 
"<tr>";
                echo 
"<td align=left valign=top>" $row['beispiel'] . " " $row['id_beispiel'] . "</td>";
           echo 
"</tr>";
            echo 
"<tr>";
                echo 
"<td><hr></td>";
            echo 
"</tr>";
        }
        echo 
"</table>";
        
// Free result set
        
mysqli_free_result($result);
    } else{
        echo 
"Es wurden keine Eintr&auml;ge passend zu Ihrer Suchanfrage gefunden!";
    }
} else{
    echo 
"ERROR: Could not able to execute $sql. " mysqli_error($link);
}
 
// Close connection
mysqli_close($link);
?>

<!--
https://www.tutorialrepublic.com/php-tutorial/php-mysql-select-query.php
-->
<!--
https://www.w3schools.com/php/php_mysql_select.asp?fbclid=IwAR2FHZEj7UkKqSe6OhCTzcezzCaS9bkJtNi3Uytv447jcLj04rZ_-qHXaAc
-->
</font>
</div>
</body>
</html>

Update von Datensätzen in der Datenbank: Formular
DOWNLOAD

<html>
<head>
<link rel="stylesheet" type="text/css" href="klins.css" media="screen" />
</head>
<body><br>
<img src="ph.png" height="30" width="1">
<br>
<form method="POST" action="update__Ge&Tei3V.php">
<table border="0">
<tr>
<td></td>
<td colspan=3><font size=+2 color="000000" face="Arial,Helvetica">
<p class=1>UPDATE Datum Inserat</td>
</tr>
<tr>
<td><img src="ph.png" height="1" width="30"></td>
<td><p class=1>Datum Inserat:</td><td><img src="ph.png" height="1" width="30"></td>
<td>
<input type="text" size="17" id="insdat" name="insdat">
</td>
</tr>
<tr>
<td></td>
<td><p class=1>Code:</td>
<td></td>
<td>
<input type="text" size="17" id="code" name="code">
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td><img src="ph.png" height="30" width="1"></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="UPDATE"></td>
</table>
</form>
</p>
</font>
</body>
</html>

Update von Datensätzen in der Datenbank: Script
DOWNLOAD

<?php
if (isset($_POST) && isset($_POST['code'])){

    
// Create connection
    
include 'dbconnect.php';
    
// Check connection
    
if ($conn->connect_error) {
        die(
"Connection failed: " $conn->connect_error);
    }
    
    
    
$sql "UPDATE datenbank SET x='".$_POST['insdat']."' WHERE code_x='".$_POST['code']."'";
    
    if (
$conn->query($sql) === TRUE) {
        echo 
"Record updated successfully";
    } else {
        echo 
"Error deleting record: " $conn->error;
    }
    
    
    
$conn->close();
}
?> 
<!-- https://stackoverflow.com/questions/21863089/update-query-using-post-values -->

Löschen von Datensätzen in der Datenbank: Formular
DOWNLOAD

<html>
<head>
<title>DELETE SOMPOSTS.CH</title>
<body>
<form method="POST" action="delete_delete_Ge&Tei3V.php">
<input type="text" size="17" id="code" name="code">
<input type="submit" value="OK">
</form>
</body>
</html>

Löschen von Datensätzen in der Datenbank: Script
DOWNLOAD

<?php
if (isset($_POST) && isset($_POST['code'])){

        include 
'dbconnect.php';
    
$dbname "datenbankname";
    
    
// Create connection
    
$conn = new mysqli($servername$username$password$dbname);
    
// Check connection
    
if ($conn->connect_error) {
        die(
"Connection failed: " $conn->connect_error);
    }
    
    
    
// sql to delete a record
    //$sql = "DELETE FROM datenbankname WHERE id_somposts='".$_POST['code']."'"; //würde auch gehen, aber folgende Zeile ist besser:
    
$sql "DELETE FROM datenbankname WHERE code_post='".$conn->real_escape_string($_POST['code'])."'";
    
    if (
$conn->query($sql) === TRUE) {
        echo 
"Record deleted successfully";
    } else {
        echo 
"Error deleting record: " $conn->error;
    }
    
    
    
$conn->close();
}
?> 

Cookie Banner | Dakitec.de