Cultureshock Posted December 11, 2009 Share Posted December 11, 2009 In the following code, Inserting into content works but not collectives. Also, when removing content, collectives still does not update. It inserts the details into content then heads straight to /collectives.php?step=2 without adding anything to collectives. mysql_query("INSERT INTO content (uid, type, title, content, commenting) VALUES('$uid', 'coll', '$title', '$desc', 'yes' ) ") or die(mysql_error()) ; mysql_query("INSERT INTO collectives (uid, title, desc) VALUES('$uid', '$title', '$desc' ) ") ; header('location:/collectives.php?step=two'); Here are the table details: Collective: cid int(11) auto_increment unique uid int(11) title varchar(50) desc varchar(150) time timestamp CURRENT_TIMESTAMP I don't see anything wrong with it? Quote Link to comment https://forums.phpfreaks.com/topic/184759-why-isnt-this-insert-working-when-another-is/ Share on other sites More sharing options...
vinpkl Posted December 11, 2009 Share Posted December 11, 2009 did u echo the query. do you get any error vineet Quote Link to comment https://forums.phpfreaks.com/topic/184759-why-isnt-this-insert-working-when-another-is/#findComment-975358 Share on other sites More sharing options...
PFMaBiSmAd Posted December 11, 2009 Share Posted December 11, 2009 LOL, your first query has some error checking and error reporting logic (the or die(mysql_error()) ) to get it to tell you if it failed and why it failed. But your second query does not. If you added that same error checking and error reporting logic to the second query, you would get an sql syntax error at the point where the desc column is listed because desc is a reserved keyword and should not be used as a column name. You should either rename the column to something else or enclose it in back-ticks ` ` Quote Link to comment https://forums.phpfreaks.com/topic/184759-why-isnt-this-insert-working-when-another-is/#findComment-975389 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.