我有一张5个列的桌子 ID, 姓名, 姓, 公司 & amp; 标题 。
所以,我现在要做的是检查提交过程中的重复条目,比较名称和姓氏组合匹配。这应该导致提醒重复条目,并选择继续将其保存到数据库,或者取消内容的提交。
提前感谢。
我有一张5个列的桌子 ID, 姓名, 姓, 公司 & amp; 标题 。
所以,我现在要做的是检查提交过程中的重复条目,比较名称和姓氏组合匹配。这应该导致提醒重复条目,并选择继续将其保存到数据库,或者取消内容的提交。
提前感谢。
您有这个选项 :
如果您真的认为这值得, 这里的替代方案是插入行, 并检查是否有前面的行。 如果客户端想要保留记录, 请留下它, 否则删除它 。
参考参考值
我试过了,但还没有弄明白 问题中提到的选择性选择法。
$query = "INSERT INTO phptablo (Name, Surname, Company, Title) VALUES ( $name , $surname , $company , $title )";
$sql = "SELECT Name AND Surname FROM phptablo WHERE Name = $name AND Surname= $surname ";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
$row = mysql_fetch_array($result);
echo "$sql" . <br/><br/> ;
echo "$result" . <br/><br/> ;
if ($count==0)
{
if (!mysql_query($query))
{
die( Error: . mysql_error());
}
echo "Successful Entry!";
}
else
{
echo "Duplicate Entry found!";
}
我对 php & amp; MySQL 的 php < general\\ em\ \ / ems\ / strong > 到 php & amp; MySQL 所以无法真正利用您非常感激的答案。 是否有机会添加一些代码来让我选择保存它?
我现在所处的位置是,如果检测到重复条目,输入没有保存到数据库中,否则它就会立即存储。如果我所写的代码不能真正被修改以保存重复,我也可以在保存后用某种屏幕显示复制件,这样它们就可以被编辑、删除等等。
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 ...
<?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 = ...
我把我的用心从使用QQL转向MySQL。 它与凯科特合作,现在不工作,因为我已经改变,使用MySQL。 这里的错误信息是:
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
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 ...
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 ...
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 ~...
My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...