English 中文(简体)
努力利用员额数据,在我sql使用php插入
原标题:trying to use post data to insert into mysql using php

我很想知道,我是否试图从我的数据库读到,如果它等于或低于那个时候,那么,那是想要id式......,直到id不在数据库中,并且使用该表格。 问题不在于如何形成从编号一开始的循环,如果存在这种id子,则对数据库进行核对,直到该id不在数据库中,并且使用该表格,因此用户可以填写表格,并将表格交给用户和另一人,其他人可以把表格上加起来,然后把表格上加起来。 用户可以在不重新输入所有数据的情况下纠正或改变表格。 i 备有所有表格。 i 有一个页,可以输入表格并填写表格,而且已经储存数据,但可以说明数据如何为定单提供通用的证明。

最佳回答

也许你不应在你桌子里人工设定该身份证。 将贵领域划入<代码> 缩略语 使其成为<条码>INT和UNSignED,最后取向于。AUTO INCREMENT。 从那里,亚洲开发银行将自动找到你的补贴和使用的下一个价值。

然后,在您的《实验室守则》中,将新填写的表格插入数据库。 并且最后加入:

$link = mysql_connect( localhost ,  mysql_user ,  mysql_password );
if (!$link) {
    die( Could not connect:   . mysql_error());
}
mysql_select_db( mydb );

mysql_query("INSERT INTO mytable (product) values ( kossu )");
printf("Last inserted record has id %d
", mysql_insert_id());

Example off php.net

Additional Code block as requested in comments:

mysql_query("INSERT INTO mytable (product) values ( kossu )");

// GETTING THE ID
$id = mysql_insert_id(); 

//USING THE ID
$body = "THIS IS AN EMAIL MESSAGE BODY, GO TO http://example.com/form.php?id=" . $id; 
mail( [email protected] ,  My Subject , $body);
问题回答

没有必要找到免费的身份证。 http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.htmlAUTO_INCREMENT栏,请该数据库为您查询。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签