Hi all,
I am desperate and I simply want to update several Datarows in
my MySQL 4.1 DB.
I get always "Call to member function (fetch-row) on non..."!
Just browse through the code and say to me what I can do about this, it is planned after pushing the "Data" Button and entry and the number to update the datarows.
ps: with only one tablefield everything functions just perfect
(perhaps it could be the query->Method...)
<html>
<body bgcolor="FFFAAA">
<p>
<?php
$mysqli = new mysqli("localhost", "admin", "", "testdb", "3306");
/ check connection /
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
/ close connection /
$mysqli->close();
?>
<form action="testfile3.php" method="get">
<input type=text maxlength="8" name="version">
<input type=submit value="Data"> <?php echo $_GET[version]; ?>
</form>
<form action="testfile3.php" method="get">
ID <input type=text maxlength="8" size="3" name="version"><p>
<textarea name="welcome">
<?php
// $mysqli <-- new connection
if(is_object($mysqli)) // check again if object was created...
{
// ja = execute commands
if (isset($GET["version"])) {
$mysqli = new mysqli("localhost", "admin", "", "testdb", "3306");
if ($result = $mysqli->query("SELECT FROM WHERE version = '$GET[version]'")) {
$row = $result->fetch_row();
printf("%s\n", $row[0]); // DB-object -> write DB->Object
$result->close();
}
}
}
// $mysqli <-- new connection
if(is_object($mysqli)) // check again if object was created...
{
// ja = execute commands
if (isset($GET["welcome"]) && (isset($GET["version"]))) {
$mysqli = new mysqli("localhost", "admin", "", "testdb", "3306");
if ($result = $mysqli->query("UPDATE SET = '$GET[welcome]' WHERE version = '$GET[version]'")) {
$row = $result->mysqli->fetch_row();
printf("%s\n", $row[0]); // DB-object -> write DB->Object
$result->close();
}
}
}
?>
</textarea>
<div align="left">Hintergrundfarbe aller Inhalte</div><br>
<textarea cols="6" rows="1" name="backgroundcolor">
<?php
// $mysqli <-- new connection
if(is_object($mysqli)) // check again if object was created...
{
// ja = execute commands
if (isset($GET["version"])) {
global $mysqli;
$mysqli = new mysqli("localhost", "admin", "", "testdb", "3306");
if ($result = $mysqli->query("SELECT design_backgroundcolor FROM deuindex WHERE version = '$GET[version]'")) {
$row = $result->fetch_row();
printf("%s\n", $row[0]); // DB-object -> write DB->Object
$result->close();
}
}
}
// $mysqli <-- new connection
if(is_object($mysqli)) // check again if object was created...
{
// ja = execute commands
if (isset($GET["backgroundcolor"]) && (isset($GET["version"]))) {
global $mysqli;
$mysqli = new mysqli("localhost", "admin", "", "testdb", "3306");
if ($result = $mysqli->query("UPDATE * SET design_backgroundcolor = '$GET[backgroundcolor]' WHERE version = '$GET[version]'")) {
$row = $result->fetch_row();
printf("%s\n", $row[0]); // DB-object -> write DB->Object
$result->close();
}
}
}
?>
</textarea>
<input type="submit">
</form>
</body>
</html>
Any sort of help is appreciated :-))