medj Posted June 9, 2008 Share Posted June 9, 2008 I am trying to implement a way to edit one piece of data in a row from my database. If you can take a quick look at: http://eldoled.blankevolution.com/. Select "Match" and then any of the 3 sub options on the right. When you click submit, you will get a page that displays many rows where the stock is listed on the right. The plan is to be able to click the Edit Link on the right and be able to edit the 'stock' value. When you hover over the edit links you will notice that the 'id' is set to the part number and it is being sent with the submit. Now the problem I am having is being able to display an edit box that will let me edit the stock of the part that I click on. Here is some of my code: The Edit Link <a href='display.php?cmd=edit&id=$get_info[1]'><b>Edit</b> - $get_info[1]</a> The query to get the required part to edit: $id = $_GET["id"]; $edit_row = mysql_query( "SELECT components.part_num, components.stock FROM components WHERE components.part_num=$id" ) or die("SELECT Error: ".mysql_error()); $myrow = mysql_fetch_array($edit_row); And just in case this might help, this is the error when I click the Edit link: SELECT Error: Unknown column '10MQ100NTRPBF' in 'where clause' The "10MQ100NTRPBF" is replaced with the part number of the link I click. Can anyone please help? Quote Link to comment Share on other sites More sharing options...
revraz Posted June 9, 2008 Share Posted June 9, 2008 Since $id is not numeric, put single quotes around it in your query. $edit_row = mysql_query( "SELECT components.part_num, components.stock FROM components WHERE components.part_num='$id'" ) Also, I don't see a reason you are selecting part_num when you already have it set in $id. 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.