1

When there is request from user i get parameter x,y,flag and sent. I insert it into table2.

$sql1 = "INSERT INTO table2 
         (id,sent,pcount,ncount,flag)
         VALUES
         ('".$_POST['id']."','".$_POST['sent']."',' $x ','$y','$flag')";

When data is inserted, below that I am showing chart, which takes inserted values x and y to show the chart.

So how on button click event I can get the values inserted in last insert operation??

Is it possible that I can create view with last row x and y values from table table2.

Table table2 has auto increment column.

4

2 回答 2

0
CREATE VIEW view_name AS
SELECT xcolumn,ycolumn
FROM table2 WHERE id=SELECT MAX(id)

假设您有一个名为 id 的递增列。

于 2013-09-12T19:14:14.303 回答
0

如果要从最后一次插入中获取数据,请使用 last_insert_id()。这将为您提供最后插入的连接 ID。

http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_last-insert-id

于 2013-09-12T19:15:52.773 回答