Search Results

Search found 1 results on 1 pages for 'littledot'.

Page 1/1 | 1 

  • Can IF be used to start a MySQL query?

    - by Littledot
    Hi there, I have a query that looks like this: mysql_query("IF EXISTS(SELECT * FROM predict WHERE uid=$i AND bid=$j) THEN UPDATE predict SET predict_tfidf=$predict_tfidf WHERE uid=$i AND bid=$j ELSE INSERT INTO predict (uid, bid, predict_tfidf) VALUES('$i','$j','$predict_tfidf') END IF")or die(mysql_error()); But it dies and mysql tells me to check the syntax near IF EXISTS(....) Can we not use an IF statement to start a mysql query? Thank you in advance.

    Read the article

1