dark_destroyer Posted April 22, 2007 Share Posted April 22, 2007 Hi All, Im trying to do something pretty simple but i cant seem to get it to work, i want to update a field in a table where and ID number is for example "1009", i use a HTML form to allow the user to type in what they want to update, the user myst type in the ID number and then the message that they want to store. It then calls the php page that has the mysql commands in it but it does not seem to connect and upate the table. Here is the code that I am using: echo ID ; echo $_REQUEST["ID"] . " was updated."; $_ID = $_REQUEST["ID"]; echo $_REQUEST["Actions"]; $_Actions = $_REQUEST["Actions"]; mysql_connect("localhost", "root","somepassword") or die(mysql_error()); mysql_select_db("task_logging") or die(mysql_error()); $query="UPDATE in_progress SET steps_taken = '$_Actions' wbere ID = '$_ID'"; $result=mysql_query($query); mysql_close(); I have tried giving the request different names, i.e $_REQUEST1 and $_REQUEST2 but that does not seem to work, can anyone see what I am doing wrong? Thanks Quote Link to comment Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 but it does not seem to connect and upate the table. can you explain this does it connect or does your connection script throw an error?? does it select the database or does it throw an error? you have the "or die" statement on the above two mysql statements so why not on your query? try this $query="UPDATE in_progress SET steps_taken = '$_Actions' wbere ID = '$_ID'"; $result=mysql_query($query)or die ("Error in the query" .mysql_error()); does this throw an error, if so what is it? Quote Link to comment Share on other sites More sharing options...
dark_destroyer Posted April 22, 2007 Author Share Posted April 22, 2007 Thanks Paul, I feel a little stupid now, it turned out to be a spelling mistake, i had "wbere ID =" instead of "where ID =" Im of to hang my head in shame! Quote Link to comment Share on other sites More sharing options...
paul2463 Posted April 22, 2007 Share Posted April 22, 2007 before you hang your head for too long can you click on the SOLVED button please? Quote Link to comment Share on other sites More sharing options...
dark_destroyer Posted April 22, 2007 Author Share Posted April 22, 2007 Yeah im trying ive looked at the post that deals with solved, but where is the box to check?? 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.