I want to insert some articles. I want to judge first, if the image value is already in the database, enter a zero value. For more information: If these figures are:
Title 1¼¼ ?? Image 1 Title 2 E¼? Image2 / This is the first image, so why should it put title 3 e¼? Image2 // image2 Already the database, therefore just insert an empty value for the title of heading 4 of the image area 4 ¼ ¼ ?? Image3 The last data entering the database should look like this:
title | Image title1ï¼? Image1 title2ï¼? Image2 Title 3 Title 4 Title 5 EER? Image3 This is my code, but it still inserts repeat value in the database. So can anyone help me? Thank you.
foreach {// First here is a foreach to make all the articles in the form of a queue ... if (empty image ($) (// first judge if inserted article was a Image value $ query1 = mysql_query ("Select from articles * where .image = '". $ Image. "'"); While ($ row = mysql_fetch_array ($ query1)) {$ image1 = $ line ['image']; }} If ((Empty ($ image1)) {// make a query first, if the image is already in the database mysql_query ("include the article (title, image) SELECT '". $ Headline. "', '');} Other {mysql_query ("Insert in Articles (Header SELECT '". $ Headline."', '". $ Image."') ;;}}
There is an error in your first query: You must remove the dot before the" image ":
where **. ** image
Comments
Post a Comment