I have an html table on a webpage which pulls information from a MySQL table using PHP. I would like to be able to edit one of the columns of this html table directly on the webpage, rather than having to go to PHP MyAdmin to do so, such the the MySQL ta开发者_开发技巧ble is also updated. Is there a way of doing this?
Here is an example of a table that I would like to edit. Specifically I would like to edit the 'Paid Column' by clicking (or double-clicking or some similar method) in any of cells and editing the information in this cell.
What you ask is:
Can I use PHP to make a sort of ADMIN page for MYSQL.
It shouldn't surprise you that PHPmyAdmin
is actually exactly that: a PHP page that changes your mysql. So yes you can, exactly the same way that phpmyadmin does it.
Now if your question is actually: how do I do this:
Make an onchange on every field that does an AJAX call to a file that executes the correct SQL.
Or you can use a "post" button if you don't want/need Async updates.
you can write in a mysql with
$sql = "INSERT INTO NameOfTable
(var1, var2, var3, var4)
VALUES
('".$var1."',
'".$var2."',
'".$var3."',
'".$var4."')";
mysql_query($sql)
Is that what you was looking for?
精彩评论