acctman Posted March 9, 2009 Share Posted March 9, 2009 This is the line below with the T_STRING error. Can someone tell me why i'm receiving the error? mysql_query("UPDATE rate_members SET m_ip=$ip, m_del_rd=NOW(), m_del_type=1 WHERE m_id=$_POST['id']"); Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/ Share on other sites More sharing options...
Mchl Posted March 9, 2009 Share Posted March 9, 2009 Change it to; mysql_query("UPDATE rate_members SET m_ip=$ip, m_del_rd=NOW(), m_del_type=1 WHERE m_id={$_POST['id']}"); Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780578 Share on other sites More sharing options...
Maq Posted March 9, 2009 Share Posted March 9, 2009 You should also have single quotes around values that aren't integers. Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780579 Share on other sites More sharing options...
Mchl Posted March 9, 2009 Share Posted March 9, 2009 You should also have single quotes around values that aren't integers. That would throw a mysql error though. I suspect there's also an error in lines above this one. Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780580 Share on other sites More sharing options...
acctman Posted March 9, 2009 Author Share Posted March 9, 2009 this is the complete section of coding. still getting an error. $ip = getenv("REMOTE_ADDR"); if(!isset($_POST['del_acct'])) { if($_POST['ban'] == 1) { delete_record($_POST['id']) mysql_query("UPDATE rate_members SET m_ip='$ip', m_del_rd='NOW()', m_del_type='1' WHERE m_id={$_POST['id']}"); } header("Location: /files/acct-removed.php"); session_destroy(); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780586 Share on other sites More sharing options...
acctman Posted March 9, 2009 Author Share Posted March 9, 2009 oh i see my error its the function delete_record($_POST['id']) should me delete_record($_POST['id']); complete fix... how does that look? $ip = getenv("REMOTE_ADDR"); if(!isset($_POST['del_acct'])) { if($_POST['ban'] == 1) { delete_record($_POST['id']); mysql_query("UPDATE rate_members SET m_ip='$ip', m_del_rd='NOW()', m_del_type=1 WHERE m_id={$_POST['id']}"); } header("Location: /files/acct-removed.php"); session_destroy(); exit; } Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780591 Share on other sites More sharing options...
Maq Posted March 9, 2009 Share Posted March 9, 2009 What exactly does the error say, specifically line #? Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780602 Share on other sites More sharing options...
Mchl Posted March 9, 2009 Share Posted March 9, 2009 complete fix... how does that look? Should be working now. Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780610 Share on other sites More sharing options...
acctman Posted March 9, 2009 Author Share Posted March 9, 2009 What exactly does the error say, specifically line #? I didn't run the script since its designed to delete accounts. i wrote it inside phpDesigner and it highlighted that line with the error. Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780615 Share on other sites More sharing options...
Maq Posted March 9, 2009 Share Posted March 9, 2009 What exactly does the error say, specifically line #? I didn't run the script since its designed to delete accounts. i wrote it inside phpDesigner and it highlighted that line with the error. So why didn't you show us that line from the beginning? Quote Link to comment https://forums.phpfreaks.com/topic/148648-syntax-error-unexpected-t_string/#findComment-780616 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.