I am a new PHP user.
Pulling data from MYSQL as shown in the figure
The table is displayed.
Erase button in foreach minutes,
I wanted to delete only the ID in the same line, I tried variously,
When you press the delete button, all IDs disappear, or the data disappears line by line when loading a page.
Was this idea wrong in the first place?
I would be pleased if someone could tell me the solution.
The code is as follows.
$pdo is a variable that is defined when displaying the table.
The table name is test_php,
php is version 5.4.16.
Answer # 1
When the screen is displayed, PHP is running (check the html in the browser's "view source").
If you want to delete only the data selected (clicked) from the list, it is common to pass the key such as id to PHP with Ajax and execute the deletion process in the background.
If it is difficult, you can attach the same name to the button, add each id to value, and submit form.
And in the current creation, $result is a value that has left foreach, so only the last data is kept
The last data is deleted when the screen is displayed without pressing the delete button.
Since it is a deletion process after the screen display process, it does not affect the display.
It has been deleted on the database.
- php foreach statement loop processing
- i want to know the execution process of the for statement in php
- php - process to create a table in wordpress db
- when displaying db information with foreach, php notice: array to string conversion in…
- in resultphp, i want to implement the process to display all the records added so far
- php - syntax error error when using foreach in wordpress
- php - how to delete wordpress error message
- how to write comparison statement inside () used for if statement of php
- ora-00933 occurs in insert~exists statement in oracle php
- php variable is not reflected in sql statement
- php - i want to create my own delete function with my own theme of wordpress
- i do not understand the meaning of as in foreach that appears in php
- how to intentionally create a zombie process in php
- php - cannot process comit method as undefined method
- whether to put the sql statement directly or as a variable in the argument of prepare when issuing the sql statement of php
- java - i want to implement a process to delete the contents selected with a radio button from the list
- php - for statement, int cannot be used well
- php - about errors in foreach processing
- i am a php beginner sql statement question
- php - how to get and display check box value in foreach?
- php - how to use last_insert_id?
- php - i don't know how to use try ~ catch and pdoexception
- i want to delete all db table data from php
- php - list is displayed by select, but insert is not possible
- php - please tell me about freeing mysql memory
- the shape of the data in the dataset in cakephp4? i want to change the data type
- [php/laravel] i want to display all of a large amount of dom
- i can't open it with "403 forbidden" after installing phpmyadmin
- php - mamp will be repelled by mysql
- php - sqlstate [hy000]: general error: 1364 user registration is not possible due to an error