如何,如果同一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')");
你不想要两个具有相同值的条目? – powtac 2011-03-24 15:09:21
是的,我不希望插入相同的值。 – Abby 2011-03-24 15:13:21
你不能把question_text设置为唯一吗? – 2011-03-24 15:13:51