开发者

Is it possible to update a MySQL table directly from a table on a web page?

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜