ballhogjoni Posted July 3, 2007 Share Posted July 3, 2007 I am wondering why this does not write to my db? Can someone help me out a little? Thanks in advance $index_page_title=$_GET['index_page_title']; if (!empty($index_page_title)) { include('config.php'); if (mysql_query('SELECT * FROM title WHERE ID==1') == TRUE) { mysql_query('UPDATE title SET Title = $index_page_title'); } else { mysql_query("INSERT INTO title (Title) VALUES ('$index_page_title')"); } Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 3, 2007 Share Posted July 3, 2007 is ther any error? Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 3, 2007 Author Share Posted July 3, 2007 No, not that I can tell Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 3, 2007 Share Posted July 3, 2007 whats the prob the insert or update Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 3, 2007 Author Share Posted July 3, 2007 It is supposed to check to see if there is a record in the table and if there is, update it and if there is not add it. It is not doing either from what I can see. Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 3, 2007 Share Posted July 3, 2007 try this if (mysql_query('SELECT * FROM title WHERE ID=1')) { // you have == on your code i dont think it proper to use == in sql and also check if this is being set $index_page_title Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted July 3, 2007 Author Share Posted July 3, 2007 yea I know that the variable is being set due to the fact that I am usinf the GET method in my form but I will try the = instead of == Quote Link to comment 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.