Monk3h Posted June 25, 2008 Share Posted June 25, 2008 mysql_query("update players set message=$message where ownerid = '1'"); When i print out the $message is prints what it should. When i change the query to update message to = message it updates all feilds as it should. But when i want to do it to all feilds where the ID = 1 it wont let me. Yes, there are feilds where there ownerid is 1, so thats not the probelm. any ideas? Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/ Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 mysql_query("update players set message='$message' where ownerid = '1'"); Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574424 Share on other sites More sharing options...
Monk3h Posted June 25, 2008 Author Share Posted June 25, 2008 that didnt work.. :/ ownerid is an INT with a char limit of 14, if that helps? =/ Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574429 Share on other sites More sharing options...
revraz Posted June 25, 2008 Share Posted June 25, 2008 mysql_query("update players set message='$message' where ownerid = 1"); If you use mysql_error after the query, it will tell you where your error is. Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574434 Share on other sites More sharing options...
Monk3h Posted June 25, 2008 Author Share Posted June 25, 2008 Nope, that didnt work ether.. :/ Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574439 Share on other sites More sharing options...
revraz Posted June 25, 2008 Share Posted June 25, 2008 If you use mysql_error after the query, it will tell you where your error is. Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574440 Share on other sites More sharing options...
Monk3h Posted June 25, 2008 Author Share Posted June 25, 2008 When i add mysql_error below the SQL query i get. Parse error: syntax error, unexpected T_PRINT in /home/monk3h/public_html/projectalpha/overview.php on line 65 When i remove it the error disapears. Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574444 Share on other sites More sharing options...
.josh Posted June 25, 2008 Share Posted June 25, 2008 mysql_query("update players set message='$message' where ownerid = 1") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574445 Share on other sites More sharing options...
Monk3h Posted June 25, 2008 Author Share Posted June 25, 2008 if ($step == 'message'){ mysql_query("update players set message=$message where ownerid = $stat[id]"); mysql_error Print "<br><br><br>Message Successfully Uptaded.<br><br><b>New Message:</b> $message"; // Line 65 } Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574447 Share on other sites More sharing options...
Monk3h Posted June 25, 2008 Author Share Posted June 25, 2008 Unknown column 'ownerid' in 'where clause' That column does exist, it is spelt exactly the same and it is in my alphaground table. I dont see what the problem is. :/ Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574449 Share on other sites More sharing options...
Monk3h Posted June 25, 2008 Author Share Posted June 25, 2008 Is there a longer way of doing what im trying to do? Select from maybie? Then n SQL update? Im unsure on the syntax. Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574453 Share on other sites More sharing options...
imdead Posted June 25, 2008 Share Posted June 25, 2008 mysql_query("update `players` set `message`='$message' where `ownerid` = '$stat[id]'"); Link to comment https://forums.phpfreaks.com/topic/111913-query-problem/#findComment-574458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.