MySQL...update...update...select...error

Hello.
Can anyone help?
I have this problem in MySQL:

  • I will display a table from the db in ListView1
  • I will update some record
  • I will show the corrected table again
  • I will update again on another record..
  • and now I can't see the table anymore..... [""]

Where am I doing wrong?
Ondrej

show responseContent on a Lable, and tell us what is the Label.text.

1;borovička|2;vodka|3;rum|4;pivo|5;vino|7;šam|25;ccchhhhhhhh|26;ddddyyyyyy|

so what's your problem/error?

What is currently in gVolba?

Is it still "init"?

Yes.

The problem is that UPDATE is executed 2 times on different records, and the tbl is displayed in ListView1. And for the third time the UPDATE is executed, but the tbl is not displayed in ListView1. So it's as if the SELECT failed repeatedly...

???
After doing your updates, send a SELECT statement to your database and display the data

Taifun

This is exactly what I do....

You are only showing partial blocks, we can not figure out where is the problem.
upload your aia if possible.

$DB_PORT="3314"; // OR 3314

$ID=$_POST["ID"];
$Nazov=$_POST["Nazov"];
//$ID=5;
//$Nazov="vino";

$conn = new mysqli($DB_ADDR,$DB_USER,$DB_PASS,$DB_NAME,$DB_PORT);
if($conn->connect_error){ //checks connection
echo "Zlyhanie DB pripojenia ERROR Database Connection Failed: " . $conn->connect_error, E_USER_ERROR; //reports a DB connection failure
exit();
} else {

$input=mysqli_query($conn, "UPDATE tblCisAlkohol SET Nazov='$Nazov' WHERE ID='$ID'");

}

mysqli_close($conn);
?>


$DB_PORT="3314"; // OR 3314

$Nazov=$_POST["Nazov"];

$conn = new mysqli($DB_ADDR,$DB_USER,$DB_PASS,$DB_NAME,$DB_PORT);
if($conn->connect_error){ //checks connection
echo "Zlyhanie DB pripojenia ERROR Database Connection Failed: " . $conn->connect_error, E_USER_ERROR; //reports a DB connection failure
} else {

$input=mysqli_query($conn, "INSERT INTO tblCisAlkohol (ID, Nazov) VALUES (NULL,'$Nazov')");

}

mysqli_close($conn);
?>


$ID=$_POST["ID"];

//$ID=24;

$conn = new mysqli($DB_ADDR,$DB_USER,$DB_PASS,$DB_NAME,$DB_PORT);
if($conn->connect_error){ //checks connection
echo "Zlyhanie DB pripojenia ERROR Database Connection Failed: " . $conn->connect_error, E_USER_ERROR; //reports a DB connection failure
exit();
} else {

$kontkod = mysqli_query($conn, "SELECT * FROM tblCisAlkohol WHERE ID='$ID'");
$kod = mysqli_num_rows($kontkod);

if ($kod > 0) {
$input=mysqli_query($conn, "DELETE FROM tblCisAlkohol WHERE ID='$ID'");
echo "Zaznam bol vymazany";
}
else {
echo "Chyba...zaznam sa nevymazal !";
}

}

mysqli_close($conn);
?>

Svadba2024.aia (26.4 KB)

Do you think it is well programmed?
Ondrej

I now looked into your project
you have to understand, that any server processing takes a little bit... which means, as already said earlier

It does not make sense, to start an update and before finishing already send the select statement to the table


Taifun

Well thank you !!!
One more problem...
ListView1 row does not change background color after click...
It also stopped working for me Visible = true ... I don't want to display the row detail from ListView1 ...
obrázok
obrázok

It worked for me before...I don't understand what I did wrong...

Senior1954 ....

Are you talking about the SelectionColor?
Set it in the BeforePicking event

Sorry, I do not understand

Taifun

When clicking on the ListView1 row, as if AfterPicking is not activated ...
I don't have a BeforePicking event in ListView1...

Senior1954

Yes, sorry... set it before opening the listview... in the AfterPicking event it is too late

Taifun

I set SekectionColor right at the beginning.
If I click on a row of the list, that color just flashes briefly and the original color is there again...

SelectionColor...