Hypersource Posted December 1, 2012 Share Posted December 1, 2012 Whats wrong with this i know its obvious : ( $cash=mysql_query("UPDATE potions SET color='$color',pet='$pet' WHERE owner='$tik' and name=' $name ' ") or die(mysql_error()); i get Unknown column 'name' in 'where clause' Quote Link to comment https://forums.phpfreaks.com/topic/271461-mysql-help-unknown-column-name-in-where-clause/ Share on other sites More sharing options...
Psycho Posted December 1, 2012 Share Posted December 1, 2012 Well, if the error is what you have put into the title of the post then the error is just as it says - there is no column with the name of "name". When debugging such errors it is always helpful to echo the actual query to the page. Otherwise you can spend hours trying to figure out a problem with a query that is actually a problem with a variable: $query = "UPDATE potions SET color='$color', pet='$pet' WHERE owner='$tik' AND name=' $name '"; $result = mysql_query($query) or die("Query: $query<br>Error: " . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/271461-mysql-help-unknown-column-name-in-where-clause/#findComment-1396753 Share on other sites More sharing options...
Jessica Posted December 1, 2012 Share Posted December 1, 2012 What is the structure of the potions table? And why aren't you updating based on a primary key? Quote Link to comment https://forums.phpfreaks.com/topic/271461-mysql-help-unknown-column-name-in-where-clause/#findComment-1396757 Share on other sites More sharing options...
Hypersource Posted December 1, 2012 Author Share Posted December 1, 2012 Whoops new this was obvious! its the wrong table i need to do the pets table sorry for wasti ng your time Quote Link to comment https://forums.phpfreaks.com/topic/271461-mysql-help-unknown-column-name-in-where-clause/#findComment-1396760 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.