【发布时间】:2011-03-24 15:07:13
【问题描述】:
如果相同的question_text 存在但first_word. 不存在,如何不插入值
示例(question_text 是整个句子,第一个单词是句子中的first word。)
他疯了。 //插入
他很聪明。 //插入
他很聪明。 //存在不插入
$first_word = current(explode(' ', $_POST['question_text']));
mysql_query("INSERT INTO questions (question_id,question_text,field_name)
VALUES ('','$_POST[question_text]','$first_word')");
【问题讨论】:
-
您不想要两个具有相同值的条目?
-
是的,我不想插入相同的值。
-
你不能将 question_text 设置为唯一的吗?