After updating to 2.12.2 i cant access the database in the code section as before (2.8.1)
Maybe someone has in idea whats wrong with my code.
mysqli_query ("UPDATE tablename SET column ='$xxxxxxx' WHERE ID=1") or die ("MySQL-Fehler: " . mysqli_error());
old code that worked:
mysql_query ("UPDATE tablename SET column ='$xxxxxxx' WHERE ID=1") or die ("MySQL-Fehler: " . mysql_error());
WB2.8.1 used MySQL, where the current WB versions (and PHP) use MySQLi.
mysqli_query() needs the handle that was created when the connection to the database was made.
WB has the $database class you can use. The correct way would be:
<?php
$database->query("YOUR QUERY");
// if you want to crash on errors (not recommended)
if($database->is_error()) die("Error: ".$database->get_error();
You are my hero :-D
Thank you
Updating works nice :-)
I realize i have to learn a lot e.g. how to readout the table
$database->query("SELECT * FROM wb_users WHERE username = test");
while ($data = mysqli_fetch_assoc($database))
{$mailadress=$data[email];
echo $mailadress;
}
You should have a look into core modules (like news, form, code) to learn.
E.g. to read a single result you can use
$database->get_one('SELECT ...
yeaaaa
from the code module section i succeeded whith this:
//Auslesen
$query = "SELECT * FROM tablename WHERE ID = 1";
$get_content = $database->query($query);
$content = $get_content->fetchRow(MYSQLI_ASSOC);
$content = ($content['email']); // \htmlspecialchars
echo $content;
THANK YOU ALL